/* libguestfs - the guestfsd daemon
- * Copyright (C) 2009 Red Hat Inc.
+ * Copyright (C) 2009 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
cpmv_cmd (const char *cmd, const char *flags, const char *src, const char *dest)
{
char *srcbuf, *destbuf;
- int srclen, destlen;
char *err;
int r;
- NEED_ROOT (-1);
- ABS_PATH (src, -1);
- ABS_PATH (dest, -1);
-
- srclen = strlen (src) + 32;
- srcbuf = malloc (srclen);
+ srcbuf = sysroot_path (src);
if (srcbuf == NULL) {
reply_with_perror ("malloc");
return -1;
}
- destlen = strlen (dest) + 32;
- destbuf = malloc (destlen);
+ destbuf = sysroot_path (dest);
if (destbuf == NULL) {
reply_with_perror ("malloc");
free (srcbuf);
return -1;
}
- snprintf (srcbuf, srclen, "/sysroot%s", src);
- snprintf (destbuf, destlen, "/sysroot%s", dest);
-
if (flags)
r = command (NULL, &err, cmd, flags, srcbuf, destbuf, NULL);
else