diff options
Diffstat (limited to 'gnu/libexec/uucp/libunix/rmdir.c')
| -rw-r--r-- | gnu/libexec/uucp/libunix/rmdir.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/gnu/libexec/uucp/libunix/rmdir.c b/gnu/libexec/uucp/libunix/rmdir.c new file mode 100644 index 000000000000..12a7b9e4507c --- /dev/null +++ b/gnu/libexec/uucp/libunix/rmdir.c @@ -0,0 +1,43 @@ +/* rmdir.c + Remove a directory on a system which doesn't have the rmdir system + call. This is only called by uupick, which is not setuid, so we + don't have to worry about the problems of invoking the setuid + /bin/rmdir program. */ + +#include "uucp.h" + +#include "sysdep.h" + +#include <errno.h> + +int +rmdir (zdir) + const char *zdir; +{ + const char *azargs[3]; + int aidescs[3]; + pid_t ipid; + + azargs[0] = RMDIR_PROGRAM; + azargs[1] = zdir; + azargs[2] = NULL; + aidescs[0] = SPAWN_NULL; + aidescs[1] = SPAWN_NULL; + aidescs[2] = SPAWN_NULL; + + ipid = ixsspawn (azargs, aidescs, TRUE, FALSE, (const char *) NULL, + TRUE, TRUE, (const char *) NULL, + (const char *) NULL, (const char *) NULL); + + if (ipid < 0) + return -1; + + if (ixswait ((unsigned long) ipid, (const char *) NULL) != 0) + { + /* Make up an errno value. */ + errno = EBUSY; + return -1; + } + + return 0; +} |
