Author: stepan Date: 2007-08-20 01:33:41 +0200 (Mon, 20 Aug 2007) New Revision: 471
Modified: LinuxBIOSv3/util/lar/lib.c Log: 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 jordan.crouse@amd.com Acked-by: Stefan Reinauer stepan@coresystems.de
Modified: LinuxBIOSv3/util/lar/lib.c =================================================================== --- LinuxBIOSv3/util/lar/lib.c 2007-08-19 23:31:58 UTC (rev 470) +++ LinuxBIOSv3/util/lar/lib.c 2007-08-19 23:33:41 UTC (rev 471) @@ -210,16 +210,29 @@ { 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 @@ ret = 0; }
+ free(realname); return ret; }