update all NEED_ROOT uses
[libguestfs.git] / daemon / augeas.c
index f75a1d6..b6cc8f0 100644 (file)
@@ -53,23 +53,20 @@ do_aug_init (char *root, int flags)
 {
 #ifdef HAVE_AUGEAS
   char *buf;
-  int len;
 
-  NEED_ROOT (-1);
-  ABS_PATH (root, -1);
+  NEED_ROOT (return -1);
+  ABS_PATH (root, return -1);
 
   if (aug) {
     aug_close (aug);
     aug = NULL;
   }
 
-  len = strlen (root) + 9;
-  buf = malloc (len);
+  buf = sysroot_path (root);
   if (!buf) {
     reply_with_perror ("malloc");
     return -1;
   }
-  snprintf (buf, len, "/sysroot%s", root);
 
   aug = aug_init (buf, NULL, flags);
   free (buf);
@@ -353,7 +350,7 @@ do_aug_ls (char *path)
 
   NEED_AUG (NULL);
 
-  ABS_PATH (path, NULL);
+  ABS_PATH (path, return NULL);
 
   len = strlen (path);