diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2012-07-11 00:05:21 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2012-07-11 00:05:21 -0700 |
commit | bb3522608f97ac2450f5501164b11adda94e9b5f (patch) | |
tree | 4ba437ab0789a2c0f31fa716a4b9b8204b222e58 /src/sysdep.c | |
parent | 249685df40653f6d48c2c75412ff2fc24ee2d958 (diff) | |
download | emacs-bb3522608f97ac2450f5501164b11adda94e9b5f.tar.gz |
Assume mkdir, rmdir.
Diffstat (limited to 'src/sysdep.c')
-rw-r--r-- | src/sysdep.c | 126 |
1 files changed, 0 insertions, 126 deletions
diff --git a/src/sysdep.c b/src/sysdep.c index 274e000e9f3..7d0855b543c 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -2075,132 +2075,6 @@ set_file_times (int fd, const char *filename, return fdutimens (fd, filename, timespec); } -/* mkdir and rmdir functions, for systems which don't have them. */ - -#ifndef HAVE_MKDIR -/* - * Written by Robert Rother, Mariah Corporation, August 1985. - * - * If you want it, it's yours. All I ask in return is that if you - * figure out how to do this in a Bourne Shell script you send me - * a copy. - * sdcsvax!rmr or rmr@uscd - * - * Severely hacked over by John Gilmore to make a 4.2BSD compatible - * subroutine. 11Mar86; hoptoad!gnu - * - * Modified by rmtodd@uokmax 6-28-87 -- when making an already existing dir, - * subroutine didn't return EEXIST. It does now. - */ - -/* - * Make a directory. - */ -int -mkdir (char *dpath, int dmode) -{ - pid_t cpid; - int status, fd; - struct stat statbuf; - - if (stat (dpath, &statbuf) == 0) - { - errno = EEXIST; /* Stat worked, so it already exists */ - return -1; - } - - /* If stat fails for a reason other than non-existence, return error */ - if (errno != ENOENT) - return -1; - - synch_process_alive = 1; - switch (cpid = fork ()) - { - - case -1: /* Error in fork */ - return (-1); /* Errno is set already */ - - case 0: /* Child process */ - /* - * Cheap hack to set mode of new directory. Since this - * child process is going away anyway, we zap its umask. - * FIXME, this won't suffice to set SUID, SGID, etc. on this - * directory. Does anybody care? - */ - status = umask (0); /* Get current umask */ - status = umask (status | (0777 & ~dmode)); /* Set for mkdir */ - fd = emacs_open ("/dev/null", O_RDWR, 0); - if (fd >= 0) - { - dup2 (fd, 0); - dup2 (fd, 1); - dup2 (fd, 2); - } - execl ("/bin/mkdir", "mkdir", dpath, (char *) 0); - _exit (-1); /* Can't exec /bin/mkdir */ - - default: /* Parent process */ - wait_for_termination (cpid); - } - - if (synch_process_death != 0 || synch_process_retcode != 0 - || synch_process_termsig != 0) - { - errno = EIO; /* We don't know why, but */ - return -1; /* /bin/mkdir failed */ - } - - return 0; -} -#endif /* not HAVE_MKDIR */ - -#ifndef HAVE_RMDIR -int -rmdir (char *dpath) -{ - int cpid, status, fd; - struct stat statbuf; - - if (stat (dpath, &statbuf) != 0) - { - /* Stat just set errno. We don't have to */ - return -1; - } - - synch_process_alive = 1; - switch (cpid = fork ()) - { - - case -1: /* Error in fork */ - return (-1); /* Errno is set already */ - - case 0: /* Child process */ - fd = emacs_open ("/dev/null", O_RDWR, 0); - if (fd >= 0) - { - dup2 (fd, 0); - dup2 (fd, 1); - dup2 (fd, 2); - } - execl ("/bin/rmdir", "rmdir", dpath, (char *) 0); - _exit (-1); /* Can't exec /bin/rmdir */ - - default: /* Parent process */ - wait_for_termination (cpid); - } - - if (synch_process_death != 0 || synch_process_retcode != 0 - || synch_process_termsig != 0) - { - errno = EIO; /* We don't know why, but */ - return -1; /* /bin/rmdir failed */ - } - - return 0; -} -#endif /* !HAVE_RMDIR */ - - #ifndef HAVE_STRSIGNAL char * strsignal (int code) |