summaryrefslogtreecommitdiff
path: root/rdoff/rdlib.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2002-05-04 05:42:30 +0000
committerH. Peter Anvin <hpa@zytor.com>2002-05-04 05:42:30 +0000
commit27cf503e03f4765e0eaaffa6aaef6d75ff1de226 (patch)
tree9567ba927109804467ccdd98a91e8c2f3cf7c0a9 /rdoff/rdlib.c
parent87242df32dd2bfad17d88570cee3509d0c3cc88d (diff)
downloadnasm-27cf503e03f4765e0eaaffa6aaef6d75ff1de226.tar.gz
nasm-27cf503e03f4765e0eaaffa6aaef6d75ff1de226.tar.bz2
nasm-27cf503e03f4765e0eaaffa6aaef6d75ff1de226.zip
RDOFF patch from Yuri Zaporogets:
- Panos Minos's LDRDF fix (correct export of relocation records); - Panos Minos's symtab.c verbose dump fix; - Librarian (rdflib) now puts a signature block when creating a library (instead of creating an empty file). In theory it doesn't break binary compatibility, but due to a bug in the original 'rdlib.c' you can't use old LDRDF with new libraries. Fix this bug as well. - Other minor changes in LDRDF.
Diffstat (limited to 'rdoff/rdlib.c')
-rw-r--r--rdoff/rdlib.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/rdoff/rdlib.c b/rdoff/rdlib.c
index ed78a00..6eee5a9 100644
--- a/rdoff/rdlib.c
+++ b/rdoff/rdlib.c
@@ -6,11 +6,13 @@
#include "rdlib.h"
/*
- * format of rdoff library files:
+ * format of RDOFF library files:
+ * optional signature ('.sig')
* repeat
* null terminated module name (max 255 chars)
* RDOFF module
* until eof
+ * optional directory ('.dir')
*/
/*
@@ -54,26 +56,27 @@ int rdl_verify(const char * filename)
i++;
if (feof(fp)) break;
- fread(buf, 6, 1, fp);
- buf[6] = 0;
if (buf[0] == '.') {
/*
- * a special module, eg a directory.
+ * A special module, eg a signature block or a directory.
* Format of such a module is defined to be:
- * six char type identifier (which we've already read)
+ * six char type identifier
* long count bytes content
* content
- * so we can handle it uniformaly with RDOFF2 modules...
- * do nothing here. :-)
+ * so we can handle it uniformaly with RDOFF2 modules.
*/
+ fread(buf, 6, 1, fp);
+ buf[6] = 0;
+ /* Currently, nothing useful to do with signature block.. */
+ } else {
+ fread(buf, 6, 1, fp);
+ buf[6] = 0;
+ if (strncmp(buf, "RDOFF", 5)) {
+ return rdl_error = lastresult = 2;
+ } else if (buf[5] != '2') {
+ return rdl_error = lastresult = 3;
+ }
}
- else if (strncmp(buf, "RDOFF", 5)) {
- return rdl_error = lastresult = 2;
- }
- else if (buf[5] != '2') {
- return rdl_error = lastresult = 3;
- }
-
fread(&length, 4, 1, fp);
fseek(fp, length, SEEK_CUR); /* skip over the module */
}