From f06734946d5c5fb29a0cd24785101921f78c7756 Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Fri, 8 Jan 2010 15:28:16 +0100 Subject: Moved write_dump() over to dmidump.c, as this is the only user of this function --- src/util.c | 36 ------------------------------------ 1 file changed, 36 deletions(-) (limited to 'src/util.c') diff --git a/src/util.c b/src/util.c index 014b75d..9bd86c5 100644 --- a/src/util.c +++ b/src/util.c @@ -154,39 +154,3 @@ void *mem_chunk(size_t base, size_t len, const char *devmem) return p; } -int write_dump(size_t base, size_t len, const void *data, const char *dumpfile, int add) -{ - FILE *f; - - f = fopen(dumpfile, add ? "r+b" : "wb"); - if(!f) { - fprintf(stderr, "%s: ", dumpfile); - perror("fopen"); - return -1; - } - - if(fseek(f, base, SEEK_SET) != 0) { - fprintf(stderr, "%s: ", dumpfile); - perror("fseek"); - goto err_close; - } - - if(fwrite(data, len, 1, f) != 1) { - fprintf(stderr, "%s: ", dumpfile); - perror("fwrite"); - goto err_close; - } - - if(fclose(f)) { - fprintf(stderr, "%s: ", dumpfile); - perror("fclose"); - return -1; - } - - return 0; - - err_close: - fclose(f); - return -1; -} - -- cgit