commit 96d5493476e68989fc23992ca608b8899e977bb8
parent 74047ab07f22e75b819e8ca45a06f890d93266fa
Author: qorg11 <qorg@vxempire.xyz>
Date: Fri, 18 Dec 2020 15:05:58 +0100
Fixed stuff in rmdir
Diffstat:
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/src/rmdir.c b/src/rmdir.c
@@ -2,18 +2,17 @@
#include <stdio.h>
#include <errno.h>
#include <string.h>
+
int
main(int argc, char *argv[]) {
- int errors = 0;
- for(int i = 1; i<argc;i++)
- {
- int fd = rmdir(argv[i]); /* Is it actually a file descriptor? */
- if(fd == -1)
- {
- fprintf(stderr,"Error removing dir %s: %i = %s\n",argv[i],
- errno,strerror(errno));
- errors++;
+
+ for(int i = 1; i<argc;i++)
+ {
+ if(rmdir(argv[i]))
+ {
+ fprintf(stderr,"rmdir: failed to remove '%s', %s\n",
+ argv[i],strerror(errno));
+ }
}
- }
- return 0;
+ return 0;
}