Magellan Linux

Diff of /tags/grubby-8_21/grubby.c

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

revision 1840 by niro, Mon Jul 2 12:48:49 2012 UTC revision 1841 by niro, Mon Jul 2 12:49:27 2012 UTC
# Line 1461  static char *findDiskForRoot() Line 1461  static char *findDiskForRoot()
1461      buf[rc] = '\0';      buf[rc] = '\0';
1462      chptr = buf;      chptr = buf;
1463    
1464        char *foundanswer = NULL;
1465    
1466      while (chptr && chptr != buf+rc) {      while (chptr && chptr != buf+rc) {
1467          devname = chptr;          devname = chptr;
1468    
# Line 1488  static char *findDiskForRoot() Line 1490  static char *findDiskForRoot()
1490           * for '/' obviously.           * for '/' obviously.
1491           */           */
1492          if (*(++chptr) == '/' && *(++chptr) == ' ') {          if (*(++chptr) == '/' && *(++chptr) == ' ') {
1493              /*              /* remember the last / entry in mtab */
1494               * Move back 2, which is the first space after the device name, set             foundanswer = devname;
              * it to \0 so strdup will just get the devicename.  
              */  
             chptr -= 2;  
             *chptr = '\0';  
             return strdup(devname);  
1495          }          }
1496    
1497          /* Next line */          /* Next line */
# Line 1503  static char *findDiskForRoot() Line 1500  static char *findDiskForRoot()
1500              chptr++;              chptr++;
1501      }      }
1502    
1503        /* Return the last / entry found */
1504        if (foundanswer) {
1505            chptr = strchr(foundanswer, ' ');
1506            *chptr = '\0';
1507            return strdup(foundanswer);
1508        }
1509    
1510      return NULL;      return NULL;
1511  }  }
1512    

Legend:
Removed from v.1840  
changed lines
  Added in v.1841