aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorqorg11 <qorg@vxempire.xyz>2020-12-18 15:05:58 +0100
committerqorg11 <qorg@vxempire.xyz>2020-12-18 15:05:58 +0100
commit96d5493476e68989fc23992ca608b8899e977bb8 (patch)
treeed4ccdd78d48080e492c3d4557aafe3c36e4772e
parent74047ab07f22e75b819e8ca45a06f890d93266fa (diff)
downloadk9core-96d5493476e68989fc23992ca608b8899e977bb8.tar.gz
k9core-96d5493476e68989fc23992ca608b8899e977bb8.zip
Fixed stuff in rmdir
-rw-r--r--src/rmdir.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/rmdir.c b/src/rmdir.c
index d943711..5c631bf 100644
--- 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;
}