diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-05-17 02:59:09 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-05-17 02:59:09 +0000 |
commit | 1f1fdb3d9dccd95363baefa04b041bcfd621c85e (patch) | |
tree | 90715dca6f2632f1f115aca612bbc4e127685d4e /libexec/ld.so/ldconfig | |
parent | ec65a6a097e60ce599230b3a582418bd356ea59e (diff) |
prep prebind_newfile() for reuse by dale in prebind; ok drahn
Diffstat (limited to 'libexec/ld.so/ldconfig')
-rw-r--r-- | libexec/ld.so/ldconfig/prebind_delete.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libexec/ld.so/ldconfig/prebind_delete.c b/libexec/ld.so/ldconfig/prebind_delete.c index 6a1c93316a3..0c07e4a96e6 100644 --- a/libexec/ld.so/ldconfig/prebind_delete.c +++ b/libexec/ld.so/ldconfig/prebind_delete.c @@ -1,4 +1,4 @@ -/* $OpenBSD: prebind_delete.c,v 1.4 2006/05/13 16:33:40 deraadt Exp $ */ +/* $OpenBSD: prebind_delete.c,v 1.5 2006/05/17 02:59:08 deraadt Exp $ */ /* * Copyright (c) 2006 Dale Rahn <drahn@dalerahn.com> @@ -33,8 +33,7 @@ int strip_prebind(char *file); int prebind_remove_load_section(int fd, char *name); -int prebind_newfile(int fd, char *name, struct stat *st, - struct prebind_footer *footer); +int prebind_newfile(int fd, char *name, struct stat *st, off_t orig_size); extern int verbose; @@ -84,7 +83,7 @@ strip_prebind(char *file) } if (rdonly) { - fd = prebind_newfile(fd, file, &st, &footer); + fd = prebind_newfile(fd, file, &st, footer.orig_size); } else { prebind_remove_load_section(fd, file); ftruncate(fd, footer.orig_size); @@ -141,8 +140,7 @@ done: } int -prebind_newfile(int infd, char *name, struct stat *st, - struct prebind_footer *footer) +prebind_newfile(int infd, char *name, struct stat *st, off_t orig_size) { struct timeval tv[2]; char *newname, *buf; @@ -191,7 +189,8 @@ prebind_newfile(int infd, char *name, struct stat *st, /* now back track, and delete the header */ if (prebind_remove_load_section(outfd, newname) == -1) goto fail; - if (ftruncate(outfd, footer->orig_size) == -1) + if (orig_size != (off_t)-1 && + ftruncate(outfd, orig_size) == -1) goto fail; /* move new file into place */ |