setadv: asprintf() doesn't return an error code
authorH. Peter Anvin <hpa@linux.intel.com>
Thu, 10 Jun 2010 01:28:34 +0000 (18:28 -0700)
committerH. Peter Anvin <hpa@linux.intel.com>
Thu, 10 Jun 2010 01:28:34 +0000 (18:28 -0700)
asprintf() doesn't return an error number, but a count of characters
(which we don't need.)

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
libinstaller/setadv.c

index 682b883..c891b87 100644 (file)
@@ -183,8 +183,8 @@ int read_adv(const char *path, const char *cfg)
     struct stat st;
     int err = 0;
 
-    err = asprintf(&file, "%s%s%s",
-       path, path[0] && path[strlen(path) - 1] == '/' ? "" : "/", cfg);
+    asprintf(&file, "%s%s%s",
+            path, path[0] && path[strlen(path) - 1] == '/' ? "" : "/", cfg);
 
     if (!file) {
        perror(program);
@@ -217,8 +217,8 @@ int read_adv(const char *path, const char *cfg)
 
     if (fd >= 0)
        close(fd);
-    if (file)
-       free(file);
+
+    free(file);
 
     return err;
 }