X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=daemon%2Fguestfsd.c;h=5c250f0184420c3c5bdd07ad53e1be64c5a3ca28;hp=87065b9de30e666555acb72cf06da5bb93e84025;hb=78029b529ad98769685d607230b70f71832d5906;hpb=e8c954933b2bfb3bc3ead5a151d49d164f1a8eab diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c index 87065b9..5c250f0 100644 --- a/daemon/guestfsd.c +++ b/daemon/guestfsd.c @@ -47,6 +47,10 @@ static void usage (void); int verbose = 0; +/* Location to mount root device. */ +const char *sysroot = "/sysroot"; /* No trailing slash. */ +int sysroot_len = 8; + int main (int argc, char *argv[]) { @@ -221,6 +225,25 @@ main (int argc, char *argv[]) exit (0); } +/* Turn "/path" into "/sysroot/path". + * + * Caller must check for NULL and call reply_with_perror ("malloc") + * if it is. Caller must also free the string. + */ +char * +sysroot_path (const char *path) +{ + char *r; + int len = strlen (path) + sysroot_len + 1; + + r = malloc (len); + if (r == NULL) + return NULL; + + snprintf (r, len, "%s%s", sysroot, path); + return r; +} + int xwrite (int sock, const void *buf, size_t len) {