char *p;
char line[64];
char *machine = NULL;
- FILE *f;
+ _cleanup_fclose_ FILE *f = NULL, *g = NULL;
f = fopen("/etc/machine-id", "re");
if (!f)
if (strlen(line) == 32)
machine = line;
}
- fclose(f);
if (!machine)
return -ESRCH;
p = strjoina(esp_path, "/loader/loader.conf");
- f = fopen(p, "wxe");
- if (f) {
- fprintf(f, "#timeout 3\n");
- fprintf(f, "default %s-*\n", machine);
- fclose(f);
- if (ferror(f))
+ g = fopen(p, "wxe");
+ if (g) {
+ fprintf(g, "#timeout 3\n");
+ fprintf(g, "default %s-*\n", machine);
+ if (ferror(g))
return log_error_errno(EIO, "Failed to write \"%s\": %m", p);
}
" --path=PATH Path to the EFI System Partition (ESP)\n"
" --no-variables Don't touch EFI variables\n"
"\n"
- "Comands:\n"
+ "Commands:\n"
" status Show status of installed systemd-boot and EFI variables\n"
" install Install systemd-boot to the ESP and EFI variables\n"
" update Update systemd-boot in the ESP and EFI variables\n"