X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=daemon%2Fcpmv.c;h=587e017d61ed5a354828c883e7d683598fff5b08;hp=33755c42eb0a2b6b79cfd92e2e514c268f8031ad;hb=39052d270fcce991238fc5f9939677b5d6e31d15;hpb=3cb794463a62239e36d730bc5d2d3eb4c7a66096 diff --git a/daemon/cpmv.c b/daemon/cpmv.c index 33755c4..587e017 100644 --- a/daemon/cpmv.c +++ b/daemon/cpmv.c @@ -1,5 +1,5 @@ /* 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 @@ -49,32 +49,22 @@ static int 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 @@ -84,7 +74,7 @@ cpmv_cmd (const char *cmd, const char *flags, const char *src, const char *dest) free (destbuf); if (r == -1) { - reply_with_error ("%s: %s", cmd, err); + reply_with_error ("%s", err); free (err); return -1; }