fix SHELL command; CR's on end of lines are still a problem, but....
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Mon, 17 Jan 1983 14:07:12 +0000 (06:07 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Mon, 17 Jan 1983 14:07:12 +0000 (06:07 -0800)
SCCS-vsn: usr.sbin/sendmail/src/srvrsmtp.c 3.44

usr/src/usr.sbin/sendmail/src/srvrsmtp.c

index 9a41227..a36991c 100644 (file)
@@ -2,10 +2,10 @@
 # include "sendmail.h"
 
 # ifndef SMTP
 # include "sendmail.h"
 
 # ifndef SMTP
-SCCSID(@(#)srvrsmtp.c  3.43            %G%     (no SMTP));
+SCCSID(@(#)srvrsmtp.c  3.44            %G%     (no SMTP));
 # else SMTP
 
 # else SMTP
 
-SCCSID(@(#)srvrsmtp.c  3.43            %G%);
+SCCSID(@(#)srvrsmtp.c  3.44            %G%);
 
 /*
 **  SMTP -- run the SMTP protocol.
 
 /*
 **  SMTP -- run the SMTP protocol.
@@ -327,7 +327,8 @@ smtp()
                        {
                                (void) close(0);
                                (void) dup(fileno(InChannel));
                        {
                                (void) close(0);
                                (void) dup(fileno(InChannel));
-                               (void) fclose(InChannel);
+                               if (fileno(InChannel) != fileno(OutChannel))
+                                       (void) fclose(InChannel);
                                InChannel = stdin;
                        }
                        if (fileno(OutChannel) != 1)
                                InChannel = stdin;
                        }
                        if (fileno(OutChannel) != 1)
@@ -337,6 +338,8 @@ smtp()
                                (void) fclose(OutChannel);
                                OutChannel = stdout;
                        }
                                (void) fclose(OutChannel);
                                OutChannel = stdout;
                        }
+                       (void) close(2);
+                       (void) dup(1);
                        execl("/bin/csh", "sendmail", 0);
                        execl("/bin/sh", "sendmail", 0);
                        message("500", "Can't");
                        execl("/bin/csh", "sendmail", 0);
                        execl("/bin/sh", "sendmail", 0);
                        message("500", "Can't");