From fd18b05542500b85cf86acb211d93d4a2ab93e25 Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Sun, 19 Aug 2007 23:33:41 +0000 Subject: [PATCH] Add another field to the filename specified for create and add operations to specify the intended pathname for the blob. Signed-off-by: Jordan Crouse Acked-by: Stefan Reinauer git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@471 f3766cd6-281f-0410-b1cd-43a5c92072e9 --- util/lar/lib.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/util/lar/lib.c b/util/lar/lib.c index edd8dcf26f..5b58f8cb22 100644 --- a/util/lar/lib.c +++ b/util/lar/lib.c @@ -210,16 +210,29 @@ int add_files(const char *name) { struct stat filestat; int ret = -1; - const char *realname; + char *realname; + char *c; - realname = name; if (strstr(name, "nocompress:") == name) { - realname = name + 11; + name += 11; } + realname = strdup(name); + + if (realname == NULL) { + fprintf(stderr, "Out of memory.\n"); + exit(1); + } + + c = strchr(realname, ':'); + + if (c != NULL) + *c = '\0'; + /* printf("... add_files %s\n", name); */ if (stat(realname, &filestat) == -1) { fprintf(stderr, "Error getting file attributes of %s\n", name); + free(realname); return -1; } @@ -264,6 +277,7 @@ int add_files(const char *name) ret = 0; } + free(realname); return ret; }