POSIX and Linux changes
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Mon, 9 Aug 1993 06:08:11 +0000 (22:08 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Mon, 9 Aug 1993 06:08:11 +0000 (22:08 -0800)
SCCS-vsn: usr.sbin/sendmail/src/main.c 8.16
SCCS-vsn: usr.sbin/sendmail/src/conf.h 8.21
SCCS-vsn: usr.sbin/sendmail/src/conf.c 8.16

usr/src/usr.sbin/sendmail/src/conf.c
usr/src/usr.sbin/sendmail/src/conf.h
usr/src/usr.sbin/sendmail/src/main.c

index 1e2f9ea..030fb0f 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)conf.c     8.15 (Berkeley) %G%";
+static char sccsid[] = "@(#)conf.c     8.16 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -1069,10 +1069,20 @@ initgroups(name, basegid)
 pid_t
 setsid __P ((void))
 {
 pid_t
 setsid __P ((void))
 {
+#ifdef TIOCNOTTY
+       int fd;
+
+       fd = open("/dev/tty", 2);
+       if (fd >= 0)
+       {
+               (void) ioctl(fd, (int) TIOCNOTTY, (char *) 0);
+               (void) close(fd);
+       }
+#endif /* TIOCNOTTY */
 # ifdef SYSTEM5
        return setpgrp();
 # else
 # ifdef SYSTEM5
        return setpgrp();
 # else
-       return 0;
+       return setpgid(0, getpid());
 # endif
 }
 
 # endif
 }
 
index a8603c0..4a636e6 100644 (file)
@@ -5,7 +5,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)conf.h      8.20 (Berkeley) %G%
+ *     @(#)conf.h      8.21 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
 # define HASSETREUID   1       /* has setreuid(2) call */
 # define HASINITGROUPS 1       /* has initgroups(3) call */
 # define FORK          fork    /* no vfork primitive available */
 # define HASSETREUID   1       /* has setreuid(2) call */
 # define HASINITGROUPS 1       /* has initgroups(3) call */
 # define FORK          fork    /* no vfork primitive available */
-# define setpgrp       BSDsetpgrp
+# define setpgid       BSDsetpgrp
 # define GIDSET_T      gid_t
 # endif
 
 # define GIDSET_T      gid_t
 # endif
 
 # define HASFLOCK      1       /* has flock(2) call */
 # define NEEDGETOPT    1       /* need a replacement for getopt(3) */
 # define sleep         sleepX
 # define HASFLOCK      1       /* has flock(2) call */
 # define NEEDGETOPT    1       /* need a replacement for getopt(3) */
 # define sleep         sleepX
+# define setpgid       setpgrp
 # define LA_TYPE       LA_ZERO
 typedef int            pid_t;
 # ifndef _PATH_SENDMAILCF
 # define LA_TYPE       LA_ZERO
 typedef int            pid_t;
 # ifndef _PATH_SENDMAILCF
@@ -232,6 +233,7 @@ typedef int         pid_t;
 # define NEEDVPRINTF   1       /* need a replacement for vprintf(3) */
 # define NEEDGETOPT    1       /* need a replacement for getopt(3) */
 # define ARBPTR_T      char *
 # define NEEDVPRINTF   1       /* need a replacement for vprintf(3) */
 # define NEEDGETOPT    1       /* need a replacement for getopt(3) */
 # define ARBPTR_T      char *
+# define setpgid       setpgrp
 # ifndef LA_TYPE
 #  define LA_TYPE      LA_FLOAT
 # endif
 # ifndef LA_TYPE
 #  define LA_TYPE      LA_FLOAT
 # endif
@@ -284,6 +286,21 @@ typedef int                pid_t;
 # define _PATH_UNIX    "/unix"
 #endif
 
 # define _PATH_UNIX    "/unix"
 #endif
 
+/*
+**  Linux 0.99pl10 and above...
+**     From Karl London <karl@borg.demon.co.uk>.
+*/
+
+#ifdef linux
+# define BSD           1       /* pretend to be BSD based today */
+# undef  NEEDVPRINTF   1       /* need a replacement for vprintf(3) */
+# define NEEDGETOPT    1       /* need a replacement for getopt(3) */
+# ifndef LA_TYPE
+#  define LA_TYPE      LA_FLOAT
+# endif
+#endif
+
+
 /**********************************************************************
 **  End of Per-Operating System defines
 **********************************************************************/
 /**********************************************************************
 **  End of Per-Operating System defines
 **********************************************************************/
index fb4ccff..b0b414d 100644 (file)
@@ -13,7 +13,7 @@ static char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)main.c     8.15 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c     8.16 (Berkeley) %G%";
 #endif /* not lint */
 
 #define        _DEFINE
 #endif /* not lint */
 
 #define        _DEFINE
@@ -1449,15 +1449,6 @@ disconnect(droplev, e)
        if (droplev > 1)
        {
                (void) setsid();
        if (droplev > 1)
        {
                (void) setsid();
-#ifdef TIOCNOTTY
-               fd = open("/dev/tty", 2);
-               if (fd >= 0)
-               {
-                       (void) ioctl(fd, (int) TIOCNOTTY, (char *) 0);
-                       (void) close(fd);
-               }
-               (void) setpgrp(0, 0);
-#endif /* TIOCNOTTY */
                errno = 0;
        }
 
                errno = 0;
        }