mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-04 19:29:37 +00:00
Assume mkdir, rmdir.
This commit is contained in:
parent
249685df40
commit
bb3522608f
6 changed files with 10 additions and 133 deletions
|
@ -7,8 +7,8 @@
|
||||||
|
|
||||||
2012-07-11 Paul Eggert <eggert@cs.ucla.edu>
|
2012-07-11 Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
|
||||||
Assume rename, strerror.
|
Assume mkdir, rename, rmdir, strerror.
|
||||||
* configure.ac (rename, strerror): Remove check.
|
* configure.ac (mkdir, rename, rmdir, strerror): Remove check.
|
||||||
|
|
||||||
2012-07-11 Glenn Morris <rgm@gnu.org>
|
2012-07-11 Glenn Morris <rgm@gnu.org>
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,6 @@ HAVE_LOGB
|
||||||
HAVE_LONG_FILE_NAMES
|
HAVE_LONG_FILE_NAMES
|
||||||
HAVE_LRAND48
|
HAVE_LRAND48
|
||||||
HAVE_MENUS
|
HAVE_MENUS
|
||||||
HAVE_MKDIR
|
|
||||||
HAVE_MKTIME
|
HAVE_MKTIME
|
||||||
HAVE_MOUSE
|
HAVE_MOUSE
|
||||||
HAVE_PSTAT_GETDYNAMIC
|
HAVE_PSTAT_GETDYNAMIC
|
||||||
|
@ -139,7 +138,6 @@ HAVE_PWD_H
|
||||||
HAVE_RANDOM
|
HAVE_RANDOM
|
||||||
HAVE_RES_INIT
|
HAVE_RES_INIT
|
||||||
HAVE_RINT
|
HAVE_RINT
|
||||||
HAVE_RMDIR
|
|
||||||
HAVE_SELECT
|
HAVE_SELECT
|
||||||
HAVE_SETLOCALE
|
HAVE_SETLOCALE
|
||||||
HAVE_SETPGID
|
HAVE_SETPGID
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
2012-07-11 Paul Eggert <eggert@cs.ucla.edu>
|
2012-07-11 Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
|
||||||
Assume perror, rename, strerror.
|
Assume mkdir, perror, rename, rmdir, strerror.
|
||||||
* CPP-DEFINES (HAVE_PERROR, HAVE_RENAME, HAVE_STRERROR, strerror):
|
* CPP-DEFINES (HAVE_MKDIR, HAVE_PERROR, HAVE_RENAME, HAVE_RMDIR)
|
||||||
|
(HAVE_STRERROR, strerror):
|
||||||
Remove.
|
Remove.
|
||||||
|
|
||||||
2012-07-10 Dmitry Antipov <dmantipov@yandex.ru>
|
2012-07-10 Dmitry Antipov <dmantipov@yandex.ru>
|
||||||
|
|
|
@ -2708,7 +2708,7 @@ AC_SUBST(BLESSMAIL_TARGET)
|
||||||
|
|
||||||
|
|
||||||
AC_CHECK_FUNCS(gethostname \
|
AC_CHECK_FUNCS(gethostname \
|
||||||
closedir mkdir rmdir getrusage get_current_dir_name \
|
closedir getrusage get_current_dir_name \
|
||||||
lrand48 logb frexp fmod cbrt setsid \
|
lrand48 logb frexp fmod cbrt setsid \
|
||||||
fpathconf select euidaccess getpagesize setlocale \
|
fpathconf select euidaccess getpagesize setlocale \
|
||||||
utimes getrlimit setrlimit setpgid getcwd shutdown getaddrinfo \
|
utimes getrlimit setrlimit setpgid getcwd shutdown getaddrinfo \
|
||||||
|
|
|
@ -20,6 +20,10 @@
|
||||||
|
|
||||||
2012-07-11 Paul Eggert <eggert@cs.ucla.edu>
|
2012-07-11 Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
|
||||||
|
Assume mkdir, rmdir.
|
||||||
|
* sysdep.c (mkdir) [!HAVE_MKDIR]: Remove.
|
||||||
|
* sysdep.c (rmdir) [!HAVE_RMDIR]: Remove.
|
||||||
|
|
||||||
Assume rename.
|
Assume rename.
|
||||||
* sysdep.c (rename) [!HAVE_RENAME]: Remove.
|
* sysdep.c (rename) [!HAVE_RENAME]: Remove.
|
||||||
|
|
||||||
|
|
126
src/sysdep.c
126
src/sysdep.c
|
@ -2074,132 +2074,6 @@ set_file_times (int fd, const char *filename,
|
||||||
timespec[1] = mtime;
|
timespec[1] = mtime;
|
||||||
return fdutimens (fd, filename, timespec);
|
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
|
#ifndef HAVE_STRSIGNAL
|
||||||
char *
|
char *
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue