]> git.ozlabs.org Git - petitboot/blobdiff - lib/pb-config/storage-powerpc-nvram.c
lib/process: Add helper for check process clean exit
[petitboot] / lib / pb-config / storage-powerpc-nvram.c
index 9dc565a099a154520edd453209620ca3cf666dd1..4b4b87830ebee29428b85d875770f5fb2b4d3f02 100644 (file)
@@ -137,8 +137,7 @@ static int parse_nvram(struct powerpc_nvram_storage *nv)
 
        rc = process_run_sync(process);
 
-       if (rc || !WIFEXITED(process->exit_status)
-                       || WEXITSTATUS(process->exit_status)) {
+       if (rc || !process_exit_ok(process)) {
                fprintf(stderr, "nvram process returned "
                                "non-zero exit status\n");
                rc = -1;
@@ -183,8 +182,7 @@ static int write_nvram(struct powerpc_nvram_storage *nv)
 
                talloc_free(paramstr);
 
-               if (rc || !WIFEXITED(process->exit_status)
-                               || WEXITSTATUS(process->exit_status)) {
+               if (rc || !process_exit_ok(process)) {
                        rc = -1;
                        pb_log("nvram update process returned "
                                        "non-zero exit status\n");
@@ -426,7 +424,7 @@ static char *dns_config_str(void *ctx, const char **dns_servers, int n)
        char *str;
        int i;
 
-       str = talloc_strdup(ctx, "dns=");
+       str = talloc_strdup(ctx, "dns,");
        for (i = 0; i < n; i++) {
                str = talloc_asprintf_append(str, "%s%s",
                                i == 0 ? "" : ",",
@@ -439,8 +437,8 @@ static char *dns_config_str(void *ctx, const char **dns_servers, int n)
 static void update_network_config(struct powerpc_nvram_storage *nv,
        struct config *config)
 {
+       unsigned int i;
        char *val;
-       int i;
 
        val = talloc_strdup(nv, "");
 
@@ -481,8 +479,7 @@ static int update_config(struct powerpc_nvram_storage *nv,
                talloc_free(val);
        }
 
-       if (config->network.n_interfaces)
-               update_network_config(nv, config);
+       update_network_config(nv, config);
 
        return write_nvram(nv);
 }