emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-24 r117438: Simplify previous patch.


From: Paul Eggert
Subject: [Emacs-diffs] emacs-24 r117438: Simplify previous patch.
Date: Sun, 10 Aug 2014 21:06:11 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117438
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/18232
committer: Paul Eggert <address@hidden>
branch nick: emacs-24
timestamp: Sun 2014-08-10 14:06:07 -0700
message:
  Simplify previous patch.
modified:
  lib/save-cwd.c                 savecwd.c-20130201062823-w76pgdl107cutopz-9
=== modified file 'lib/save-cwd.c'
--- a/lib/save-cwd.c    2014-08-10 20:40:57 +0000
+++ b/lib/save-cwd.c    2014-08-10 21:06:07 +0000
@@ -50,14 +50,14 @@
    you're still using an obsolete system with these problems, please
    send email to the maintainer of this code.  */
 
+#if !defined HAVE_FCHDIR && !defined fchdir
+# define fchdir(fd) (-1)
+#endif
+
 int
 save_cwd (struct saved_cwd *cwd)
 {
-#ifdef HAVE_FCHDIR
   cwd->desc = open (".", O_SEARCH | O_CLOEXEC);
-#else
-  cwd->desc = -1;
-#endif
   /* The 'name' member is present only to minimize differences from
      gnulib.  Initialize it to zero, if only to simplify debugging.  */
   cwd->name = 0;
@@ -71,16 +71,14 @@
 int
 restore_cwd (const struct saved_cwd *cwd)
 {
-#ifdef HAVE_FCHDIR
   /* 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)
     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;
 }
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]