aboutsummaryrefslogtreecommitdiff
path: root/binutils/resres.c
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2001-07-17 03:14:49 +0000
committerDJ Delorie <dj@redhat.com>2001-07-17 03:14:49 +0000
commit5f16d8553b4c39526585af46fe6253b4e7500709 (patch)
tree1eb4f2b6196472d0c359d96fde57faf58e72f514 /binutils/resres.c
parentcf759d3bc0e43da69c26f1c0a176042da8cf23a5 (diff)
downloadgdb-5f16d8553b4c39526585af46fe6253b4e7500709.zip
gdb-5f16d8553b4c39526585af46fe6253b4e7500709.tar.gz
gdb-5f16d8553b4c39526585af46fe6253b4e7500709.tar.bz2
* resres.c (write_res_header): Align header size.
(res_align_file): Calculate alignment correctly.
Diffstat (limited to 'binutils/resres.c')
-rw-r--r--binutils/resres.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/binutils/resres.c b/binutils/resres.c
index 6a860eb..616772e 100644
--- a/binutils/resres.c
+++ b/binutils/resres.c
@@ -387,6 +387,8 @@ write_res_header (datasize, type, name, resinfo)
reshdr.data_size = datasize;
reshdr.header_size = 24 + get_id_size (type) + get_id_size (name);
+ reshdr.header_size = (reshdr.header_size + 3) & ~3;
+
res_align_file ();
write_res_data (&reshdr, sizeof (reshdr), 1);
write_res_id (type);
@@ -513,7 +515,9 @@ read_unistring (len)
static void
res_align_file (void)
{
- if (fseek (fres, ftell (fres) % 4, SEEK_CUR) != 0)
+ int pos = ftell (fres);
+ int skip = ((pos + 3) & ~3) - pos;
+ if (fseek (fres, skip, SEEK_CUR) != 0)
fatal ("%s: %s: unable to align file", program_name, filename);
}