diff options
Diffstat (limited to 'src/firejail/cpu.c')
-rw-r--r-- | src/firejail/cpu.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/firejail/cpu.c b/src/firejail/cpu.c index 9462568f2..6dcbbd07b 100644 --- a/src/firejail/cpu.c +++ b/src/firejail/cpu.c | |||
@@ -71,23 +71,17 @@ void save_cpu(void) { | |||
71 | if (cfg.cpus == 0) | 71 | if (cfg.cpus == 0) |
72 | return; | 72 | return; |
73 | 73 | ||
74 | char *fname; | 74 | FILE *fp = fopen(CPU_CFG, "w"); |
75 | if (asprintf(&fname, "%s/cpu", MNT_DIR) == -1) | ||
76 | errExit("asprintf"); | ||
77 | FILE *fp = fopen(fname, "w"); | ||
78 | if (fp) { | 75 | if (fp) { |
79 | fprintf(fp, "%x\n", cfg.cpus); | 76 | fprintf(fp, "%x\n", cfg.cpus); |
80 | fclose(fp); | 77 | fclose(fp); |
81 | if (chown(fname, 0, 0) < 0) | 78 | if (chown(CPU_CFG, 0, 0) < 0) |
82 | errExit("chown"); | 79 | errExit("chown"); |
83 | } | 80 | } |
84 | else { | 81 | else { |
85 | fprintf(stderr, "Error: cannot save cpu affinity mask\n"); | 82 | fprintf(stderr, "Error: cannot save cpu affinity mask\n"); |
86 | free(fname); | ||
87 | exit(1); | 83 | exit(1); |
88 | } | 84 | } |
89 | |||
90 | free(fname); | ||
91 | } | 85 | } |
92 | 86 | ||
93 | void load_cpu(const char *fname) { | 87 | void load_cpu(const char *fname) { |