]> git.ozlabs.org Git - petitboot/blobdiff - lib/file/file.c
lib/file: remove mkstemp umask in copy_file_secure_dest
[petitboot] / lib / file / file.c
index 0d187887c701f75183fcec4550f33cb292a9198a..b575d343150ebbb246d8c0ccf5961a68fd434708 100644 (file)
@@ -37,14 +37,13 @@ int copy_file_secure_dest(void *ctx, const char *source_file,
                char **destination_file)
 {
        char readlink_buffer[MAX_FILENAME_SIZE + 1];
-       char dest_filename[MAX_FILENAME_SIZE] = "";
+       char dest_filename[MAX_FILENAME_SIZE + 1] = "";
        char template[] = "/tmp/petitbootXXXXXX";
        FILE *destination_handle, *source_handle;
        int destination_fd, result = 0;
        unsigned char *buffer;
        ssize_t r;
        size_t l1;
-       mode_t oldmask;
 
        source_handle = fopen(source_file, "r");
        if (!source_handle) {
@@ -53,9 +52,7 @@ int copy_file_secure_dest(void *ctx, const char *source_file,
                        return -1;
        }
 
-       oldmask = umask(0644);
        destination_fd = mkstemp(template);
-       umask(oldmask);
        if (destination_fd < 0) {
                pb_log("%s: unable to create temp file, %m\n", __func__);
                fclose(source_handle);