]> git.ozlabs.org Git - yaboot.git/blobdiff - second/file.c
Commit yaboot 1.3.6-pre2
[yaboot.git] / second / file.c
index b88706977b7dad3b54db7ebc95ecb647c6dd81d2..366d5ba9dbff93cf56c7a48c1dbcbbb230802bc2 100644 (file)
@@ -83,14 +83,19 @@ parse_device_path(char *imagepath, char *defdevice, int defpart,
          }
      }
 
-     if ((ptr = strrchr(ipath, ',')) != NULL) {
-         char *colon = strrchr(ipath, ':');
-         /* If a ':' occurs *after* a ',', then we assume that there is
-            no filename */
-         if (!colon || colon < ptr) {
-              result->file = strdup(ptr+1);
-              /* Trim the filename off */
-              *ptr = 0;
+     /* if there is no : then there is no filename or partition.  must
+        use strrchr() since enet:,10.0.0.1,file is legal */
+
+     if (strchr(ipath, ':') != NULL) {
+         if ((ptr = strrchr(ipath, ',')) != NULL) {
+              char *colon = strrchr(ipath, ':');
+              /* If a ':' occurs *after* a ',', then we assume that there is
+                 no filename */
+              if (!colon || colon < ptr) {
+                   result->file = strdup(ptr+1);
+                   /* Trim the filename off */
+                   *ptr = 0;
+              }
          }
      }