Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site uwvax.ARPA Path: utzoo!watmath!clyde!floyd!harpo!seismo!uwvax!dave From: dave@uwvax.ARPA Newsgroups: net.unix-wizards,net.bugs.2bsd Subject: bug in 2.9bsd passwd (and others) -- bad exit status Message-ID: <308@uwvax.ARPA> Date: Wed, 20-Jun-84 12:03:18 EDT Article-I.D.: uwvax.308 Posted: Wed Jun 20 12:03:18 1984 Date-Received: Thu, 21-Jun-84 08:35:41 EDT Organization: U of Wisconsin CS Dept Lines: 69 Index: /usr/src/cmd/passwd.c 2.9bsd Description: Passwd returns a non-zero exit status even when it has set the password correctly. This causes any programs which look at the status to see if the password was set to fail. Repeat-By: < use csh > % passwd anyuser < set the password correctly > % echo $status < the value will be non-zero > Fix: This is not necessarily the best fix, but is short and works! *** passwd.c.orig Fri Jun 8 12:56:45 1984 --- passwd.c Tue Jun 19 09:42:57 1984 *************** *** 37,42 int pwlen; FILE *tf; char *uname; insist = 0; if(argc < 2) { --- 37,43 ----- int pwlen; FILE *tf; char *uname; + int exitstat = 1; insist = 0; if(argc < 2) { *************** *** 180,185 goto out; } while((u=read(fi,buf,sizeof(buf))) > 0) write(fo,buf,u); out: unlink(temp); --- 181,187 ----- goto out; } while((u=read(fi,buf,sizeof(buf))) > 0) write(fo,buf,u); + exitstat = 0; /* no errors! */ out: unlink(temp); *************** *** 185,189 unlink(temp); bex: ! exit(1); } --- 187,191 ----- unlink(temp); bex: ! exit(exitstat); } -- Dave Cohrs @ wisconsin ...!{allegra,heurikon,ihnp4,seismo,sfwin,ucbvax,uwm-evax}!uwvax!dave dave@wisc-rsch.arpa