You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jim Jagielski <ji...@jaguNET.com> on 1997/06/16 17:35:14 UTC

[PATCH] spawn_child_err NTvsUNIX cleanup

This patch simply makes things a bit clearer in the functions
called by spawn_child_err. NT requires a return value but UNIX
doesn't. In fact, if UNIX does return, then it's and error.
The previous version did a exit(1);return(0); which was confusing.

Index: apache/src/alloc.c
===================================================================
RCS file: /export/home/cvs/apache/src/alloc.c,v
retrieving revision 1.29
diff -c -r1.29 alloc.c
*** alloc.c	1997/06/15 19:22:23	1.29
--- alloc.c	1997/06/16 15:32:40
***************
*** 1187,1193 ****
      signal (SIGCHLD, SIG_DFL);	/* Was that it? */
      
      func (data);
!     exit (0);			/* Should never get here... */
    }
  
    /* Parent process */
--- 1187,1193 ----
      signal (SIGCHLD, SIG_DFL);	/* Was that it? */
      
      func (data);
!     exit (1);			/* Should never get here... */
    }
  
    /* Parent process */
Index: apache/src/mod_log_agent.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_log_agent.c,v
retrieving revision 1.12
diff -c -r1.12 mod_log_agent.c
*** mod_log_agent.c	1997/06/15 19:22:30	1.12
--- mod_log_agent.c	1997/06/16 15:32:41
***************
*** 102,108 ****
       * may want a common framework for this, since I expect it will
       * be common for other foo-loggers to want this sort of thing...
       */
!     int child_pid = 0;
  
      cleanup_for_exec();
      signal (SIGHUP, SIG_IGN);
--- 102,108 ----
       * may want a common framework for this, since I expect it will
       * be common for other foo-loggers to want this sort of thing...
       */
!     int child_pid = 1;
  
      cleanup_for_exec();
      signal (SIGHUP, SIG_IGN);
***************
*** 117,123 ****
  #endif    
      perror ("exec");
      fprintf (stderr, "Exec of shell for logging failed!!!\n");
-     exit (1);
      return(child_pid);
  }
  
--- 117,122 ----
Index: apache/src/mod_log_config.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_log_config.c,v
retrieving revision 1.29
diff -c -r1.29 mod_log_config.c
*** mod_log_config.c	1997/06/15 19:22:30	1.29
--- mod_log_config.c	1997/06/16 15:32:47
***************
*** 679,685 ****
       * may want a common framework for this, since I expect it will
       * be common for other foo-loggers to want this sort of thing...
       */
!     int child_pid = 0;
  
      cleanup_for_exec();
  #ifdef SIGHUP
--- 679,685 ----
       * may want a common framework for this, since I expect it will
       * be common for other foo-loggers to want this sort of thing...
       */
!     int child_pid = 1;
  
      cleanup_for_exec();
  #ifdef SIGHUP
***************
*** 696,702 ****
  #endif
      perror ("exec");
      fprintf (stderr, "Exec of shell for logging failed!!!\n");
-     exit (1);
      return(child_pid);
  }
  
--- 696,701 ----
Index: apache/src/mod_log_referer.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_log_referer.c,v
retrieving revision 1.12
diff -c -r1.12 mod_log_referer.c
*** mod_log_referer.c	1997/06/15 19:22:30	1.12
--- mod_log_referer.c	1997/06/16 15:32:47
***************
*** 116,122 ****
       * may want a common framework for this, since I expect it will
       * be common for other foo-loggers to want this sort of thing...
       */
!     int child_pid = 0;
  
      cleanup_for_exec();
      signal (SIGHUP, SIG_IGN);
--- 116,122 ----
       * may want a common framework for this, since I expect it will
       * be common for other foo-loggers to want this sort of thing...
       */
!     int child_pid = 1;
  
      cleanup_for_exec();
      signal (SIGHUP, SIG_IGN);
***************
*** 132,138 ****
  #endif
      perror ("execl");
      fprintf (stderr, "Exec of shell for logging failed!!!\n");
-     exit (1);
      return(child_pid);
  }
  
--- 132,137 ----
Index: apache/src/mod_rewrite.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_rewrite.c,v
retrieving revision 1.29
diff -c -r1.29 mod_rewrite.c
*** mod_rewrite.c	1997/06/15 19:22:31	1.29
--- mod_rewrite.c	1997/06/16 15:32:53
***************
*** 2282,2301 ****
  /* Child process code for 'RewriteLog "|..."' */
  static int rewritelog_child(void *cmd)
  {
!     int child_pid = 0;
  
      cleanup_for_exec();
      signal(SIGHUP, SIG_IGN);
  #if defined(WIN32)
      child_pid = spawnl(SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL);
-     return(child_pid);
  #elif defined(__EMX__)
      /* OS/2 needs a '/' */
      execl(SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL);
  #else
      execl(SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, NULL);
  #endif
-     exit(1);
      return(child_pid);
  }
  
--- 2282,2299 ----
  /* Child process code for 'RewriteLog "|..."' */
  static int rewritelog_child(void *cmd)
  {
!     int child_pid = 1;
  
      cleanup_for_exec();
      signal(SIGHUP, SIG_IGN);
  #if defined(WIN32)
      child_pid = spawnl(SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL);
  #elif defined(__EMX__)
      /* OS/2 needs a '/' */
      execl(SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL);
  #else
      execl(SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, NULL);
  #endif
      return(child_pid);
  }
  
***************
*** 2435,2455 ****
  /* child process code */
  static int rewritemap_program_child(void *cmd)
  {
!     int child_pid = 0;
      
      cleanup_for_exec();
      signal(SIGHUP, SIG_IGN);
  #if defined(WIN32)
      child_pid = spawnl(SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL);
-     return(child_pid);
  #elif defined(__EMX__)
      /* OS/2 needs a '/' */
      execl(SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL);
  #else
      execl(SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, NULL);
  #endif
!     exit(1);
!     return(0);
  }
  
  
--- 2433,2451 ----
  /* child process code */
  static int rewritemap_program_child(void *cmd)
  {
!     int child_pid = 1;
      
      cleanup_for_exec();
      signal(SIGHUP, SIG_IGN);
  #if defined(WIN32)
      child_pid = spawnl(SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL);
  #elif defined(__EMX__)
      /* OS/2 needs a '/' */
      execl(SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL);
  #else
      execl(SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, NULL);
  #endif
!     return(child_pid);
  }
  
  

-- 
====================================================================
      Jim Jagielski            |       jaguNET Access Services
     jim@jaguNET.com           |       http://www.jaguNET.com/
            "Look at me! I'm wearing a cardboard belt!"