changeset 1408:43bed82c87df draft

As long as I had to write xabspath(), no point in wrapping realpath().
author Rob Landley <rob@landley.net>
date Wed, 30 Jul 2014 19:22:55 -0500
parents 434ea531a62c
children f477dc852d3b
files lib/xwrap.c toys/other/losetup.c
diffstat 2 files changed, 2 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lib/xwrap.c	Tue Jul 29 20:04:38 2014 -0500
+++ b/lib/xwrap.c	Wed Jul 30 19:22:55 2014 -0500
@@ -421,14 +421,6 @@
   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);
--- a/toys/other/losetup.c	Tue Jul 29 20:04:38 2014 -0500
+++ b/toys/other/losetup.c	Wed Jul 30 19:22:55 2014 -0500
@@ -106,8 +106,9 @@
     }
   // 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;