Magellan Linux

Diff of /trunk/grubby/grubby.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2236 by niro, Mon Oct 21 13:19:07 2013 UTC revision 2246 by niro, Mon Oct 21 13:53:05 2013 UTC
# Line 230  const char *grub2FindConfig(struct confi Line 230  const char *grub2FindConfig(struct confi
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      }      }
# Line 958  static struct grubConfig * readConfig(co Line 966  static struct grubConfig * readConfig(co
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) {
# Line 4188  int main(int argc, const char ** argv) { Line 4199  int main(int argc, const char ** argv) {
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    

Legend:
Removed from v.2236  
changed lines
  Added in v.2246