allow the user to specify a file more than once on the command line --
authorDavid Henkel-Wallace <gumby@cygnus>
Fri, 19 Apr 1991 18:04:37 +0000 (18:04 +0000)
committerDavid Henkel-Wallace <gumby@cygnus>
Fri, 19 Apr 1991 18:04:37 +0000 (18:04 +0000)
the duplicate references are ignored.
::wq

binutils/ar.c

index 0ba83ca1dcfd37d67e371ed0484ecc97df9426af..c5478741fa55f29fd42b16c6a9c36489a6ab3f0f 100644 (file)
@@ -511,7 +511,6 @@ extract_file(abfd)
                exit(1);
            }
        }
-       /* no need to byte-swap; the two formats are presumably compatible(!) */
        fwrite(cbuf, 1, nread, ostream);
        ncopied += tocopy;
     }
@@ -845,6 +844,14 @@ replace_members(files_to_move)
                if (newer_only) {
                    struct stat     fsbuf,
                                    asbuf;
+
+                   if (current->arelt_data == NULL) {
+                     /* This can only happen if you specify a file on the
+                        command line more than once. */
+                     fprintf (stderr, "Duplicate file specified: %s -- skipping.\n", *files_to_move);
+                     goto next_file;
+                   }
+
                    if (stat(*files_to_move, &fsbuf) != 0) {
                        if (errno != ENOENT)
                            bfd_fatal(*files_to_move);