home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / uucp-1.04 / unix / rmdir.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-02-13  |  908 b   |  44 lines

  1. /* rmdir.c
  2.    Remove a directory on a system which doesn't have the rmdir system
  3.    call.  This is only called by uupick, which is not setuid, so we
  4.    don't have to worry about the problems of invoking the setuid
  5.    /bin/rmdir program.  */
  6.  
  7. #include "uucp.h"
  8.  
  9. #include "sysdep.h"
  10.  
  11. #include <errno.h>
  12.  
  13. int
  14. rmdir (zdir)
  15.      const char *zdir;
  16. {
  17.   const char *azargs[3];
  18.   int aidescs[3];
  19.   pid_t ipid;
  20.  
  21.   azargs[0] = RMDIR_PROGRAM;
  22.   azargs[1] = zdir;
  23.   azargs[2] = NULL;
  24.   aidescs[0] = SPAWN_NULL;
  25.   aidescs[1] = SPAWN_NULL;
  26.   aidescs[2] = SPAWN_NULL;
  27.  
  28.   ipid = ixsspawn (azargs, aidescs, TRUE, FALSE, (const char *) NULL,
  29.            TRUE, TRUE, (const char *) NULL,
  30.            (const char *) NULL, (const char *) NULL);
  31.  
  32.   if (ipid < 0)
  33.     return -1;
  34.  
  35.   if (ixswait ((unsigned long) ipid, (const char *) NULL) != 0)
  36.     {
  37.       /* Make up an errno value.  */
  38.       errno = EBUSY;
  39.       return -1;
  40.     }
  41.  
  42.   return 0;
  43. }
  44.