git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
inspector: Fix inspector/Makefile.am
[libguestfs.git]
/
daemon
/
cpmv.c
diff --git
a/daemon/cpmv.c
b/daemon/cpmv.c
index
b87d7a4
..
47b8aa2
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 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
@@
-28,19
+28,19
@@
static int cpmv_cmd (const char *cmd, const char *flags, const char *src, const char *dest);
int
static int cpmv_cmd (const char *cmd, const char *flags, const char *src, const char *dest);
int
-do_cp (c
har *src,
char *dest)
+do_cp (c
onst char *src, const
char *dest)
{
return cpmv_cmd ("cp", NULL, src, dest);
}
int
{
return cpmv_cmd ("cp", NULL, src, dest);
}
int
-do_cp_a (c
har *src,
char *dest)
+do_cp_a (c
onst char *src, const
char *dest)
{
return cpmv_cmd ("cp", "-a", src, dest);
}
int
{
return cpmv_cmd ("cp", "-a", src, dest);
}
int
-do_mv (c
har *src,
char *dest)
+do_mv (c
onst char *src, const
char *dest)
{
return cpmv_cmd ("mv", NULL, src, dest);
}
{
return cpmv_cmd ("mv", NULL, src, dest);
}
@@
-49,32
+49,22
@@
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);
-
if (flags)
r = command (NULL, &err, cmd, flags, srcbuf, destbuf, NULL);
else
if (flags)
r = command (NULL, &err, cmd, flags, srcbuf, destbuf, NULL);
else