]> git.ozlabs.org Git - petitboot/blobdiff - discover/paths.c
po: Update help string and add untranslated strings
[petitboot] / discover / paths.c
index 54774cf3b6135cb9ffdac41b0f3f731e7699d1b0..1269dded35b73960c6b3d51c00efcd1b6e6aaafa 100644 (file)
@@ -6,6 +6,8 @@
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
 
 #include <talloc/talloc.h>
 #include <system/system.h>
@@ -49,9 +51,12 @@ char *join_paths(void *alloc_ctx, const char *a, const char *b)
 static char *local_name(void *ctx)
 {
        char *ret, tmp[] = "/tmp/pb-XXXXXX";
+       mode_t oldmask;
        int fd;
 
+       oldmask = umask(0644);
        fd = mkstemp(tmp);
+       umask(oldmask);
 
        if (fd < 0)
                return NULL;
@@ -220,15 +225,16 @@ static enum tftp_type check_tftp_type(void *ctx)
        const char *argv[] = { pb_system_apps.tftp, "-V", NULL };
        struct process *process;
        enum tftp_type type;
+       int rc;
 
        process = process_create(ctx);
        process->path = pb_system_apps.tftp;
        process->argv = argv;
        process->keep_stdout = true;
        process->add_stderr = true;
-       process_run_sync(process);
+       rc = process_run_sync(process);
 
-       if (!process->stdout_buf || process->stdout_len == 0) {
+       if (rc || !process->stdout_buf || process->stdout_len == 0) {
                pb_log("Can't check TFTP client type!\n");
                type = TFTP_TYPE_BROKEN;
 
@@ -310,8 +316,9 @@ static void load_wget(struct load_task *task, int flags)
                pb_system_apps.wget,
                "-O",
                NULL, /* 2: local file */
-               NULL,
-               NULL,
+               NULL, /* 3 (optional): --quiet */
+               NULL, /* 4 (optional): --no-check-certificate */
+               NULL, /* 5: URL */
                NULL,
        };
        int i;