Date: Thu, 12 Oct 2000 01:30:02 -0700 (PDT) From: Dag-Erling Smorgrav <des@ofug.org> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/21918: Unjustified basename code removal and subsequent breakage Message-ID: <200010120830.BAA93633@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/21918; it has been noted by GNATS. From: Dag-Erling Smorgrav <des@ofug.org> To: ak03@gte.com Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: bin/21918: Unjustified basename code removal and subsequent breakage Date: 12 Oct 2000 10:27:39 +0200 I will commit the following patch later today: Index: basename.c =================================================================== RCS file: /home/ncvs/src/usr.bin/basename/basename.c,v retrieving revision 1.5 diff -u -r1.5 basename.c --- basename.c 2000/09/06 07:28:02 1.5 +++ basename.c 2000/10/12 08:23:25 @@ -73,8 +73,9 @@ if ((p = basename(argv[0])) == NULL) err(1, "%s", argv[0]); - if (*++argv && (q = strstr(p, *argv)) && strcmp(q, *argv) == 0) - *q = '\0'; + if (*++argv && (q = strchr(p, '\0') - strlen(*argv)) > p && + strcmp(*argv, q) == 0) + *q = '\0'; (void)printf("%s\n", p); exit(0); } DES -- Dag-Erling Smorgrav - des@ofug.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200010120830.BAA93633>