mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-11 08:30:45 -08:00
Simplify previous patch.
Fixes: debbugs:18232
This commit is contained in:
parent
f22bc725a1
commit
db2f09ab1b
1 changed files with 8 additions and 10 deletions
|
|
@ -50,14 +50,14 @@
|
||||||
you're still using an obsolete system with these problems, please
|
you're still using an obsolete system with these problems, please
|
||||||
send email to the maintainer of this code. */
|
send email to the maintainer of this code. */
|
||||||
|
|
||||||
|
#if !defined HAVE_FCHDIR && !defined fchdir
|
||||||
|
# define fchdir(fd) (-1)
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
save_cwd (struct saved_cwd *cwd)
|
save_cwd (struct saved_cwd *cwd)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_FCHDIR
|
|
||||||
cwd->desc = open (".", O_SEARCH | O_CLOEXEC);
|
cwd->desc = open (".", O_SEARCH | O_CLOEXEC);
|
||||||
#else
|
|
||||||
cwd->desc = -1;
|
|
||||||
#endif
|
|
||||||
/* The 'name' member is present only to minimize differences from
|
/* The 'name' member is present only to minimize differences from
|
||||||
gnulib. Initialize it to zero, if only to simplify debugging. */
|
gnulib. Initialize it to zero, if only to simplify debugging. */
|
||||||
cwd->name = 0;
|
cwd->name = 0;
|
||||||
|
|
@ -71,16 +71,14 @@ save_cwd (struct saved_cwd *cwd)
|
||||||
int
|
int
|
||||||
restore_cwd (const struct saved_cwd *cwd)
|
restore_cwd (const struct saved_cwd *cwd)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_FCHDIR
|
|
||||||
/* Restore the previous directory if possible, to avoid tying down
|
/* Restore the previous directory if possible, to avoid tying down
|
||||||
the file system of the new directory (Bug#18232). */
|
the file system of the new directory (Bug#18232).
|
||||||
|
Don't worry if fchdir fails, as Emacs doesn't care what the
|
||||||
|
working directory is. The fchdir call is inside an 'if' merely to
|
||||||
|
pacify compilers that complain if fchdir's return value is ignored. */
|
||||||
if (fchdir (cwd->desc) == 0)
|
if (fchdir (cwd->desc) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Don't worry if fchdir fails, as Emacs doesn't care what the
|
|
||||||
working directory is. The fchdir call is inside an 'if' merely to
|
|
||||||
pacify compilers that complain if fchdir's return value is ignored. */
|
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue