230 |
}; |
}; |
231 |
static int i = -1; |
static int i = -1; |
232 |
static const char *grub_cfg = "/boot/grub/grub.cfg"; |
static const char *grub_cfg = "/boot/grub/grub.cfg"; |
233 |
|
int rc = -1; |
234 |
|
|
235 |
if (i == -1) { |
if (i == -1) { |
236 |
for (i = 0; configFiles[i] != NULL; i++) { |
for (i = 0; configFiles[i] != NULL; i++) { |
237 |
dbgPrintf("Checking \"%s\": ", configFiles[i]); |
dbgPrintf("Checking \"%s\": ", configFiles[i]); |
238 |
if (!access(configFiles[i], R_OK)) { |
if ((rc = access(configFiles[i], R_OK))) { |
239 |
|
if (errno == EACCES) { |
240 |
|
printf("Unable to access bootloader configuration file " |
241 |
|
"\"%s\": %m\n", configFiles[i]); |
242 |
|
exit(1); |
243 |
|
} |
244 |
|
continue; |
245 |
|
} else { |
246 |
dbgPrintf("found\n"); |
dbgPrintf("found\n"); |
247 |
return configFiles[i]; |
return configFiles[i]; |
248 |
} |
} |
966 |
int len; |
int len; |
967 |
char * buf; |
char * buf; |
968 |
|
|
969 |
if (!strcmp(inName, "-")) { |
if (inName == NULL) { |
970 |
|
printf("Could not find bootloader configuration\n"); |
971 |
|
exit(1); |
972 |
|
} else if (!strcmp(inName, "-")) { |
973 |
in = 0; |
in = 0; |
974 |
} else { |
} else { |
975 |
if ((in = open(inName, O_RDONLY)) < 0) { |
if ((in = open(inName, O_RDONLY)) < 0) { |
4199 |
return 0; |
return 0; |
4200 |
} |
} |
4201 |
|
|
4202 |
|
if (grubConfig == NULL) { |
4203 |
|
printf("Could not find bootloader configuration file.\n"); |
4204 |
|
exit(1); |
4205 |
|
} |
4206 |
|
|
4207 |
config = readConfig(grubConfig, cfi); |
config = readConfig(grubConfig, cfi); |
4208 |
if (!config) return 1; |
if (!config) return 1; |
4209 |
|
|