File: rmdir.c

package info (click to toggle)
uucp 1.07-19.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,964 kB
  • ctags: 3,210
  • sloc: ansic: 53,817; sh: 4,491; makefile: 232; perl: 199
file content (43 lines) | stat: -rw-r--r-- 908 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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;
}