git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
appliance: udev-174 moves udevd to /lib/udev/udevd (instead of /sbin/udevd)
[libguestfs.git]
/
daemon
/
cpmv.c
diff --git
a/daemon/cpmv.c
b/daemon/cpmv.c
index
33755c4
..
e5457d6
100644
(file)
--- a/
daemon/cpmv.c
+++ b/
daemon/cpmv.c
@@
-1,5
+1,5
@@
/* libguestfs - the guestfsd daemon
/* libguestfs - the guestfsd daemon
- * Copyright (C) 2009
Red Hat Inc.
+ * Copyright (C) 2009
-2011 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
*
* 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,31
+49,23
@@
static int
cpmv_cmd (const char *cmd, const char *flags, const char *src, const char *dest)
{
char *srcbuf, *destbuf;
cpmv_cmd (const char *cmd, const char *flags, const char *src, const char *dest)
{
char *srcbuf, *destbuf;
- int srclen, destlen;
char *err;
int r;
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;
}
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;
}
if (destbuf == NULL) {
reply_with_perror ("malloc");
free (srcbuf);
return -1;
}
- snprintf (srcbuf, srclen, "/sysroot%s", src);
- snprintf (destbuf, destlen, "/sysroot%s", dest);
+ pulse_mode_start ();
if (flags)
r = command (NULL, &err, cmd, flags, srcbuf, destbuf, NULL);
if (flags)
r = command (NULL, &err, cmd, flags, srcbuf, destbuf, NULL);
@@
-84,11
+76,14
@@
cpmv_cmd (const char *cmd, const char *flags, const char *src, const char *dest)
free (destbuf);
if (r == -1) {
free (destbuf);
if (r == -1) {
- reply_with_error ("%s: %s", cmd, err);
+ pulse_mode_cancel ();
+ reply_with_error ("%s", err);
free (err);
return -1;
}
free (err);
free (err);
return -1;
}
free (err);
+ pulse_mode_end ();
+
return 0;
}
return 0;
}