emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-24 r117647: * emacs.c (main): Don't chdir to $HOME o


From: Jan D.
Subject: [Emacs-diffs] emacs-24 r117647: * emacs.c (main): Don't chdir to $HOME on Cocoa if --chdir was given.
Date: Fri, 31 Oct 2014 15:18:42 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117647
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/18846
committer: Jan D. <address@hidden>
branch nick: emacs-24
timestamp: Fri 2014-10-31 16:18:36 +0100
message:
  * emacs.c (main): Don't chdir to $HOME on Cocoa if --chdir was given.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/emacs.c                    emacs.c-20091113204419-o5vbwnq5f7feedwu-241
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-10-30 19:15:38 +0000
+++ b/src/ChangeLog     2014-10-31 15:18:36 +0000
@@ -1,3 +1,8 @@
+2014-10-31  Jan Djärv  <address@hidden>
+
+       * emacs.c (main): Don't chdir to $HOME on Cocoa if --chdir
+       was given (Bug#18846).
+
 2014-10-30  Jan Djärv  <address@hidden>
 
        * nsterm.h (ns_set_doc_edited): Declare taking no args.

=== modified file 'src/emacs.c'
--- a/src/emacs.c       2014-04-18 06:40:15 +0000
+++ b/src/emacs.c       2014-10-31 15:18:36 +0000
@@ -716,7 +716,7 @@
 #ifdef DAEMON_MUST_EXEC
   char dname_arg2[80];
 #endif
-  char *ch_to_dir;
+  char *ch_to_dir = 0;
 
   /* If we use --chdir, this records the original directory.  */
   char *original_pwd = 0;
@@ -1240,19 +1240,19 @@
       /* Started from GUI? */
       /* FIXME: Do the right thing if getenv returns NULL, or if
          chdir fails.  */
-      if (! inhibit_window_system && ! isatty (0))
+      if (! inhibit_window_system && ! isatty (0) && ! ch_to_dir)
         chdir (getenv ("HOME"));
       if (skip_args < argc)
         {
           if (!strncmp (argv[skip_args], "-psn", 4))
             {
               skip_args += 1;
-              chdir (getenv ("HOME"));
+              if (! ch_to_dir) chdir (getenv ("HOME"));
             }
           else if (skip_args+1 < argc && !strncmp (argv[skip_args+1], "-psn", 
4))
             {
               skip_args += 2;
-              chdir (getenv ("HOME"));
+              if (! ch_to_dir) chdir (getenv ("HOME"));
             }
         }
 #endif  /* COCOA */


reply via email to

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