Fixed stuff in rmdir

This commit is contained in:
qorg11 2020-12-18 15:05:58 +01:00
parent 74047ab07f
commit 96d5493476
No known key found for this signature in database
GPG Key ID: 343FC20A4ACA62B9
1 changed files with 10 additions and 11 deletions

View File

@ -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;
}