Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!bbn!apple!vsi1!lmb From: lmb@vicom.COM (Larry Blair) Newsgroups: news.software.b Subject: Re: News 2.11.17 breaks "batch" Message-ID: <1428@vsi1.COM> Date: 28 Jan 89 00:52:36 GMT References: <1424@vsi1.COM> <1426@vsi1.COM> Reply-To: lmb@vicom.COM (Larry Blair) Organization: VICOM Systems Inc., San Jose, CA Lines: 63 Here is a patch that fixes the problem with batch. I only wrote it for systems that have BSD4_2 or USG defined, since I don't know that a get current directory function is available on other types. This patch won't hurt those systems, but they should be sure that the batch file name given to batch is a full pathname (starts with a /). *** batch.c.2.17 Fri Jan 27 16:22:19 1989 --- batch.c Fri Jan 27 16:44:04 1989 *************** *** 42,47 **** --- 42,48 ---- #if defined(USG) || defined(BSD4_2) #include + char saved_dir[PATHLEN]; #endif struct stat sbuf; *************** *** 92,99 **** exit(1); } if (chdir(SPOOLDIR) < 0) { ! logerror("chdir(%s): %s", workfile, sys_errlist[errno]); exit(1); } --- 93,107 ---- exit(1); } + #if defined(USG) + getcwd(saved_dir, PATHLEN); + #endif + #if defined(BSD4_2) + getwd(saved_dir); + #endif + if (chdir(SPOOLDIR) < 0) { ! logerror("chdir(%s): %s", SPOOLDIR, sys_errlist[errno]); exit(1); } *************** *** 150,155 **** --- 158,171 ---- break; } } + + #if defined(USG) || defined(BSD4_2) + if (chdir(saved_dir) < 0) { + logerror("chdir(%s): %s", saved_dir, sys_errlist[errno]); + exit(1); + } + #endif + if (fdstatus != NULL) { /* exceeded maxbytes */ char tmpfile[512]; -- Larry Blair ames!vsi1!lmb lmb@vicom.com