err not getting set early enough
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 16 Mar 1991 07:41:11 +0000 (23:41 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 16 Mar 1991 07:41:11 +0000 (23:41 -0800)
SCCS-vsn: usr.bin/ar/replace.c 5.8

usr/src/usr.bin/ar/replace.c

index 97a3efa..335fffd 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)replace.c  5.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)replace.c  5.8 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -47,6 +47,7 @@ replace(argv)
        int err, exists, tfd1, tfd2;
        char *rname();
 
        int err, exists, tfd1, tfd2;
        char *rname();
 
+       err = 0;
        /*
         * If doesn't exist, simply append to the archive.  There's
         * a race here, but it's pretty short, and not worth fixing.
        /*
         * If doesn't exist, simply append to the archive.  There's
         * a race here, but it's pretty short, and not worth fixing.
@@ -71,7 +72,7 @@ replace(argv)
         * all back together at the end.
         */
        mods = (options & (AR_A|AR_B));
         * all back together at the end.
         */
        mods = (options & (AR_A|AR_B));
-       for (err = 0, curfd = tfd1; get_arobj(afd);) {
+       for (curfd = tfd1; get_arobj(afd);) {
                if (*argv && (file = files(argv))) {
                        if ((sfd = open(file, O_RDONLY)) < 0) {
                                err = 1;
                if (*argv && (file = files(argv))) {
                        if ((sfd = open(file, O_RDONLY)) < 0) {
                                err = 1;