As long as I had to write xabspath(), no point in wrapping realpath().
authorRob Landley <rob@landley.net>
Thu, 31 Jul 2014 00:22:55 +0000 (19:22 -0500)
committerRob Landley <rob@landley.net>
Thu, 31 Jul 2014 00:22:55 +0000 (19:22 -0500)
lib/xwrap.c
toys/other/losetup.c

index 4516250..4d8ad71 100644 (file)
@@ -421,14 +421,6 @@ error:
   return NULL;
 }
 
-// Resolve all symlinks, returning malloc() memory.
-char *xrealpath(char *path)
-{
-  char *new = realpath(path, NULL);
-  if (!new) perror_exit("realpath '%s'", path);
-  return new;
-}
-
 void xchdir(char *path)
 {
   if (chdir(path)) error_exit("chdir '%s'", path);
index aad722e..e96a125 100644 (file)
@@ -106,8 +106,9 @@ static void loopback_setup(char *device, char *file)
     }
   // Associate file with this device?
   } else if (file) {
-    char *s = xrealpath(file);
+    char *s = xabspath(file, 1);
 
+    if (!s) perror_exit("file"); // already opened, but if deleted since...
     if (ioctl(lfd, LOOP_SET_FD, ffd)) perror_exit("%s=%s", device, file);
     loop->lo_offset = TT.offset;
     loop->lo_sizelimit = TT.size;