summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>1995-08-10 23:09:46 +0000
committerRoland McGrath <roland@redhat.com>1995-08-10 23:09:46 +0000
commit70465ffcfbd67461eb879e2c8c7d59aeda138aa9 (patch)
tree741adbfd4f24f06f2dbaa1601c6294acf4dfcef8
parentee2b67af6d1c0f63c293545d1d5fc16768ecff32 (diff)
downloadgunmake-70465ffcfbd67461eb879e2c8c7d59aeda138aa9.tar.gz
(ar_scan) [AIAMAG]: Check for zero MEMBER_OFFSET, indicating a valid, but
empty, archive.
-rw-r--r--arscan.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/arscan.c b/arscan.c
index a3dce83..e63659e 100644
--- a/arscan.c
+++ b/arscan.c
@@ -1,5 +1,5 @@
/* Library function for scanning an archive file.
- Copyright (C) 1987, 89, 91, 92, 93, 94 Free Software Foundation, Inc.
+ Copyright (C) 1987, 89, 91, 92, 93, 94, 95 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -144,6 +144,13 @@ ar_scan (archive, function, arg)
sscanf (fl_header.fl_fstmoff, "%12ld", &member_offset);
sscanf (fl_header.fl_lstmoff, "%12ld", &last_member_offset);
+
+ if (member_offset == 0)
+ {
+ /* Empty archive. */
+ close (desc);
+ return 0;
+ }
#else
#ifndef M_XENIX
register long int member_offset = sizeof (int);