]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix Haiku build for recent changes to system headers
authorPo Lu <luangruo@yahoo.com>
Wed, 26 Oct 2022 06:59:49 +0000 (14:59 +0800)
committerPo Lu <luangruo@yahoo.com>
Wed, 26 Oct 2022 07:00:35 +0000 (15:00 +0800)
* src/callproc.c (emacs_posix_spawn_init_actions): Do not use
posix_spawn_file_actions_addchdir on Haiku; it links but does
not work.

src/callproc.c

index 2d457b3c84c29d6712147dc5a474a7c4827de273..1337d2b9de12ad0b0c529f121e39920ce2d0c0c8 100644 (file)
@@ -1306,29 +1306,29 @@ emacs_posix_spawn_init_actions (posix_spawn_file_actions_t *actions,
     return error;
 
   error = posix_spawn_file_actions_adddup2 (actions, std_in,
-                                            STDIN_FILENO);
+                                           STDIN_FILENO);
   if (error != 0)
     goto out;
 
   error = posix_spawn_file_actions_adddup2 (actions, std_out,
-                                            STDOUT_FILENO);
+                                           STDOUT_FILENO);
   if (error != 0)
     goto out;
 
   error = posix_spawn_file_actions_adddup2 (actions,
-                                            std_err < 0 ? std_out
-                                                        : std_err,
-                                            STDERR_FILENO);
+                                           std_err < 0 ? std_out
+                                                       : std_err,
+                                           STDERR_FILENO);
   if (error != 0)
     goto out;
 
-  error =
-#ifdef HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR
-    posix_spawn_file_actions_addchdir
+  /* Haiku appears to have linkable posix_spawn_file_actions_chdir,
+     but it always fails.  So use the _np function instead.  */
+#if defined HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR && !defined HAIKU
+  error = posix_spawn_file_actions_addchdir (actions, cwd);
 #else
-    posix_spawn_file_actions_addchdir_np
+  error = posix_spawn_file_actions_addchdir_np (actions, cwd);
 #endif
-    (actions, cwd);
   if (error != 0)
     goto out;
 
@@ -1347,9 +1347,9 @@ emacs_posix_spawn_init_attributes (posix_spawnattr_t *attributes,
     return error;
 
   error = posix_spawnattr_setflags (attributes,
-                                    POSIX_SPAWN_SETSID
-                                      | POSIX_SPAWN_SETSIGDEF
-                                      | POSIX_SPAWN_SETSIGMASK);
+                                   POSIX_SPAWN_SETSID
+                                   | POSIX_SPAWN_SETSIGDEF
+                                   | POSIX_SPAWN_SETSIGMASK);
   if (error != 0)
     goto out;