From: lenny@icus.ICUS.COM (Lenny Tropiano) Newsgroups: unix-pc.bugs,alt.sources Subject: Patch to reroute(1) [HDB uucp rmail job rerouter] Version 1.3 Message-ID: <1117@icus.ICUS.COM> Date: 6 Mar 90 02:44:42 GMT Prequisite: Reroute Version 1.2 This patch will bring the reroute program up to version 1.3, basically a bug fix was reported that it will break filenames that are exactly 14 characters on SYSV machines because the DIR entry will not be null terminated. Also a chdir() was added to decrease search time. -- cut here -- -- cut here -- -- cut here -- -- cut here -- -- cut here -- *** 1.2/reroute.c Tue Nov 7 19:13:28 1989 --- 1.3/reroute.c Mon Mar 5 21:40:41 1990 *************** *** 2,8 ** ** ** Program name: reroute.c (Reroute rmail uux jobs to another node) ** ** Programmer: Lenny Tropiano ** ! ** E-Mail address: ...!icus!lenny -or- lenny@icus.islp.ny.us ** ** Organization: ICUS Software Systems (c)1989 ** ** Date: November 5, 1989 [Version 1.0] ** ** Patchlevel: November 6, 1989 [Version 1.1] ** --- 2,8 ----- ** ** ** Program name: reroute.c (Reroute rmail uux jobs to another node) ** ** Programmer: Lenny Tropiano ** ! ** E-Mail address: ...!icus!lenny -or- lenny@icus.ICUS.COM ** ** Organization: ICUS Software Systems (c)1989 ** ** Date: November 5, 1989 [Version 1.0] ** ** Patchlevel: November 6, 1989 [Version 1.1] ** *************** *** 10,15 ** wasn't stat()'ing the full path of the directory, ** ** in find_path(). ** ** Reported by Lee Ziegenhals (lcz@sat.datapoint.com) ** ** ** ************************************************************************** ** ** --- 10,23 ----- ** wasn't stat()'ing the full path of the directory, ** ** in find_path(). ** ** Reported by Lee Ziegenhals (lcz@sat.datapoint.com) ** + ** Patchlevel: March 5, 1990 [Version 1.3]: bug fix where on ** + ** System V machines, filenames that are exactly 14 ** + ** characters does break the strcmp() function because ** + ** of no "NULL" termination, this was changed to a ** + ** strncmp() with a strlen(of the file in question). ** + ** For performance, a chdir() to the UUCPSPOOL ** + ** directory was added -- making search time minimal. ** + ** Reported by Dave Rand (dlr@daver.bungi.com) ** ** ** ************************************************************************** ** ** *************** *** 59,66 int c, badpath = 0, /* bad -p option */ error_flg = 0; /* some error on argv */ ! char *jobid, /* job id to be rerouted */ ! *newpath, /* new path to be reroute to */ *strchr(), qsystem[SYSLEN]; /* system name for uux */ void reroute(), --- 67,74 ----- int c, badpath = 0, /* bad -p option */ error_flg = 0; /* some error on argv */ ! char *jobid = NULL, /* job id to be rerouted */ ! *newpath = NULL, /* new path to be reroute to */ *strchr(), qsystem[SYSLEN]; /* system name for uux */ void reroute(), *************** *** 173,179 void copy_to(); sprintf(jobfile,"C.%s",jobid); ! if ((directory = find_path(UUCP_SPOOL,jobfile)) == (char *)NULL) { printf("%s: no uucp job with id: %s\n", progname, jobid); exit(0); } --- 181,193 ----- void copy_to(); sprintf(jobfile,"C.%s",jobid); ! if (chdir(UUCP_SPOOL)) { ! fprintf(stderr,"%s: can't change directory to %s.\n", ! progname, UUCP_SPOOL); ! perror("chdir()"); ! exit(1); ! } ! if ((directory = find_path(".",jobfile)) == (char *)NULL) { printf("%s: no uucp job with id: %s\n", progname, jobid); exit(0); } *************** *** 378,384 (char *)NULL) return(retdir); } ! if (strcmp(dentry->d_name,file) == 0) return(dirname); } } --- 392,398 ----- (char *)NULL) return(retdir); } ! if (strncmp(dentry->d_name,file,strlen(file)) == 0) return(dirname); } } *************** *** 387,389 return((char *)NULL); } --- 401,404 ----- return((char *)NULL); } + -- | Lenny Tropiano ICUS Software Systems lenny@icus.ICUS.COM | | {ames,pacbell,decuac,sbcs,hombre,rayssd}!icus!lenny attmail!icus!lenny | +------ ICUS Software Systems -- PO Box 1; Islip Terrace, NY 11752 ------+