From: Jim Meyering <meyering(a)redhat.com>
run this command:
git grep -l -w ABS_PATH|xargs perl -pi -e \
's/(?:ABS_PATH)( \(.*?,) (.*?)\)/ABS_PATH$1 return $2)/'
---
daemon/augeas.c | 4 ++--
daemon/checksum.c | 2 +-
daemon/cmp.c | 4 ++--
daemon/cpmv.c | 4 ++--
daemon/dir.c | 12 ++++++------
daemon/du.c | 2 +-
daemon/fallocate.c | 2 +-
daemon/file.c | 20 ++++++++++----------
daemon/find.c | 2 +-
daemon/glob.c | 2 +-
daemon/grep.c | 2 +-
daemon/grub.c | 2 +-
daemon/headtail.c | 2 +-
daemon/hexdump.c | 2 +-
daemon/initrd.c | 2 +-
daemon/inotify.c | 2 +-
daemon/link.c | 4 ++--
daemon/ls.c | 2 +-
daemon/mknod.c | 2 +-
daemon/mount.c | 6 +++---
daemon/readdir.c | 2 +-
daemon/realpath.c | 2 +-
daemon/scrub.c | 4 ++--
daemon/stat.c | 6 +++---
daemon/strings.c | 2 +-
daemon/swap.c | 6 +++---
daemon/tar.c | 4 ++--
daemon/wc.c | 2 +-
daemon/xattr.c | 2 +-
29 files changed, 55 insertions(+), 55 deletions(-)
diff --git a/daemon/augeas.c b/daemon/augeas.c
index 79d41a4..45f86cf 100644
--- a/daemon/augeas.c
+++ b/daemon/augeas.c
@@ -55,7 +55,7 @@ do_aug_init (char *root, int flags)
char *buf;
NEED_ROOT (-1);
- ABS_PATH (root, -1);
+ ABS_PATH (root, return -1);
if (aug) {
aug_close (aug);
@@ -350,7 +350,7 @@ do_aug_ls (char *path)
NEED_AUG (NULL);
- ABS_PATH (path, NULL);
+ ABS_PATH (path, return NULL);
len = strlen (path);
diff --git a/daemon/checksum.c b/daemon/checksum.c
index bd71182..d12413f 100644
--- a/daemon/checksum.c
+++ b/daemon/checksum.c
@@ -37,7 +37,7 @@ do_checksum (char *csumtype, char *path)
int len;
NEED_ROOT (NULL);
- ABS_PATH (path, NULL);
+ ABS_PATH (path, return NULL);
if (strcasecmp (csumtype, "crc") == 0)
program = "cksum";
diff --git a/daemon/cmp.c b/daemon/cmp.c
index a2d92a3..30574e2 100644
--- a/daemon/cmp.c
+++ b/daemon/cmp.c
@@ -35,8 +35,8 @@ do_equal (char *file1, char *file2)
int r;
NEED_ROOT (-1);
- ABS_PATH (file1, -1);
- ABS_PATH (file2, -1);
+ ABS_PATH (file1, return -1);
+ ABS_PATH (file2, return -1);
file1buf = sysroot_path (file1);
if (file1buf == NULL) {
diff --git a/daemon/cpmv.c b/daemon/cpmv.c
index 289a2da..37f1219 100644
--- a/daemon/cpmv.c
+++ b/daemon/cpmv.c
@@ -53,8 +53,8 @@ cpmv_cmd (const char *cmd, const char *flags, const char *src, const
char *dest)
int r;
NEED_ROOT (-1);
- ABS_PATH (src, -1);
- ABS_PATH (dest, -1);
+ ABS_PATH (src, return -1);
+ ABS_PATH (dest, return -1);
srcbuf = sysroot_path (src);
if (srcbuf == NULL) {
diff --git a/daemon/dir.c b/daemon/dir.c
index 5945862..20cbd24 100644
--- a/daemon/dir.c
+++ b/daemon/dir.c
@@ -35,7 +35,7 @@ do_rmdir (char *path)
int r;
NEED_ROOT (-1);
- ABS_PATH (path, -1);
+ ABS_PATH (path, return -1);
CHROOT_IN;
r = rmdir (path);
@@ -60,7 +60,7 @@ do_rm_rf (char *path)
char *buf, *err;
NEED_ROOT (-1);
- ABS_PATH (path, -1);
+ ABS_PATH (path, return -1);
if (strcmp (path, "/") == 0) {
reply_with_error ("rm -rf: cannot remove root directory");
@@ -94,7 +94,7 @@ do_mkdir (char *path)
int r;
NEED_ROOT (-1);
- ABS_PATH (path, -1);
+ ABS_PATH (path, return -1);
CHROOT_IN;
r = mkdir (path, 0777);
@@ -160,7 +160,7 @@ do_mkdir_p (char *path)
int r;
NEED_ROOT (-1);
- ABS_PATH (path, -1);
+ ABS_PATH (path, return -1);
CHROOT_IN;
r = recursive_mkdir (path);
@@ -181,7 +181,7 @@ do_is_dir (char *path)
struct stat buf;
NEED_ROOT (-1);
- ABS_PATH (path, -1);
+ ABS_PATH (path, return -1);
CHROOT_IN;
r = lstat (path, &buf);
@@ -205,7 +205,7 @@ do_mkdtemp (char *template)
char *r;
NEED_ROOT (NULL);
- ABS_PATH (template, NULL);
+ ABS_PATH (template, return NULL);
CHROOT_IN;
r = mkdtemp (template);
diff --git a/daemon/du.c b/daemon/du.c
index 735132a..7d9c663 100644
--- a/daemon/du.c
+++ b/daemon/du.c
@@ -37,7 +37,7 @@ do_du (char *path)
char *buf;
NEED_ROOT (-1);
- ABS_PATH (path, -1);
+ ABS_PATH (path, return -1);
/* Make the path relative to /sysroot. */
buf = sysroot_path (path);
diff --git a/daemon/fallocate.c b/daemon/fallocate.c
index 47e84c6..f61c496 100644
--- a/daemon/fallocate.c
+++ b/daemon/fallocate.c
@@ -33,7 +33,7 @@ do_fallocate (char *path, int len)
int fd, r;
NEED_ROOT (-1);
- ABS_PATH (path, -1);
+ ABS_PATH (path, return -1);
CHROOT_IN;
fd = open (path, O_WRONLY | O_CREAT | O_TRUNC | O_NOCTTY, 0666);
diff --git a/daemon/file.c b/daemon/file.c
index d2ada99..e185132 100644
--- a/daemon/file.c
+++ b/daemon/file.c
@@ -36,7 +36,7 @@ do_touch (char *path)
int r;
NEED_ROOT (-1);
- ABS_PATH (path, -1);
+ ABS_PATH (path, return -1);
CHROOT_IN;
fd = open (path, O_WRONLY | O_CREAT | O_NOCTTY, 0666);
@@ -148,7 +148,7 @@ do_read_lines (char *path)
ssize_t n;
NEED_ROOT (NULL);
- ABS_PATH (path, NULL);
+ ABS_PATH (path, return NULL);
CHROOT_IN;
fp = fopen (path, "r");
@@ -195,7 +195,7 @@ do_rm (char *path)
int r;
NEED_ROOT (-1);
- ABS_PATH (path, -1);
+ ABS_PATH (path, return -1);
CHROOT_IN;
r = unlink (path);
@@ -215,7 +215,7 @@ do_chmod (int mode, char *path)
int r;
NEED_ROOT (-1);
- ABS_PATH (path, -1);
+ ABS_PATH (path, return -1);
CHROOT_IN;
r = chmod (path, mode);
@@ -235,7 +235,7 @@ do_chown (int owner, int group, char *path)
int r;
NEED_ROOT (-1);
- ABS_PATH (path, -1);
+ ABS_PATH (path, return -1);
CHROOT_IN;
r = chown (path, owner, group);
@@ -255,7 +255,7 @@ do_exists (char *path)
int r;
NEED_ROOT (-1);
- ABS_PATH (path, -1);
+ ABS_PATH (path, return -1);
CHROOT_IN;
r = access (path, F_OK);
@@ -271,7 +271,7 @@ do_is_file (char *path)
struct stat buf;
NEED_ROOT (-1);
- ABS_PATH (path, -1);
+ ABS_PATH (path, return -1);
CHROOT_IN;
r = lstat (path, &buf);
@@ -295,7 +295,7 @@ do_write_file (char *path, char *content, int size)
int fd;
NEED_ROOT (-1);
- ABS_PATH (path, -1);
+ ABS_PATH (path, return -1);
if (size == 0)
size = strlen (content);
@@ -331,7 +331,7 @@ do_read_file (char *path, size_t *size_r)
char *r;
NEED_ROOT (NULL);
- ABS_PATH (path, NULL);
+ ABS_PATH (path, return NULL);
CHROOT_IN;
fd = open (path, O_RDONLY);
@@ -445,7 +445,7 @@ do_zfile (char *method, char *path)
char line[256];
NEED_ROOT (NULL);
- ABS_PATH (path, NULL);
+ ABS_PATH (path, return NULL);
if (strcmp (method, "gzip") == 0 || strcmp (method, "compress") ==
0)
zcat = "zcat";
diff --git a/daemon/find.c b/daemon/find.c
index 40f1b3b..c514177 100644
--- a/daemon/find.c
+++ b/daemon/find.c
@@ -60,7 +60,7 @@ do_find (char *dir)
char str[PATH_MAX];
NEED_ROOT (NULL);
- ABS_PATH (dir, NULL);
+ ABS_PATH (dir, return NULL);
sysrootdir = sysroot_path (dir);
if (!sysrootdir) {
diff --git a/daemon/glob.c b/daemon/glob.c
index f15d5e5..1c47ba5 100644
--- a/daemon/glob.c
+++ b/daemon/glob.c
@@ -32,7 +32,7 @@ do_glob_expand (char *pattern)
glob_t buf;
NEED_ROOT (NULL);
- ABS_PATH (pattern, NULL); /* Required so chroot can be used. */
+ ABS_PATH (pattern, return NULL); /* Required so chroot can be used. */
/* glob(3) in glibc never calls chdir, so this seems to be safe: */
CHROOT_IN;
diff --git a/daemon/grep.c b/daemon/grep.c
index c51dc0b..19e4683 100644
--- a/daemon/grep.c
+++ b/daemon/grep.c
@@ -36,7 +36,7 @@ grep (const char *prog, const char *flag, char *regex, char *path)
char **lines;
NEED_ROOT (NULL);
- ABS_PATH (path, NULL);
+ ABS_PATH (path, return NULL);
/* Make the path relative to /sysroot. */
buf = sysroot_path (path);
diff --git a/daemon/grub.c b/daemon/grub.c
index 118771f..8fcd911 100644
--- a/daemon/grub.c
+++ b/daemon/grub.c
@@ -33,7 +33,7 @@ do_grub_install (char *root, char *device)
char *buf;
NEED_ROOT (-1);
- ABS_PATH (root, -1);
+ ABS_PATH (root, return -1);
RESOLVE_DEVICE (device, return -1);
if (asprintf_nowarn (&buf, "--root-directory=%R", root) == -1) {
diff --git a/daemon/headtail.c b/daemon/headtail.c
index af2648c..bdd0f49 100644
--- a/daemon/headtail.c
+++ b/daemon/headtail.c
@@ -36,7 +36,7 @@ headtail (const char *prog, const char *flag, const char *n, char
*path)
char **lines;
NEED_ROOT (NULL);
- ABS_PATH (path, NULL);
+ ABS_PATH (path, return NULL);
/* Make the path relative to /sysroot. */
buf = sysroot_path (path);
diff --git a/daemon/hexdump.c b/daemon/hexdump.c
index e2d8300..27ea108 100644
--- a/daemon/hexdump.c
+++ b/daemon/hexdump.c
@@ -33,7 +33,7 @@ do_hexdump (char *path)
char *out, *err;
NEED_ROOT (NULL);
- ABS_PATH (path, NULL);
+ ABS_PATH (path, return NULL);
buf = sysroot_path (path);
if (!buf) {
diff --git a/daemon/initrd.c b/daemon/initrd.c
index 59749bb..e703481 100644
--- a/daemon/initrd.c
+++ b/daemon/initrd.c
@@ -38,7 +38,7 @@ do_initrd_list (char *path)
size_t len;
NEED_ROOT (NULL);
- ABS_PATH (path, NULL);
+ ABS_PATH (path, return NULL);
/* "zcat /sysroot/<path> | cpio --quiet -it", but path must be quoted.
*/
if (asprintf_nowarn (&cmd, "zcat %R | cpio --quiet -it", path) == -1) {
diff --git a/daemon/inotify.c b/daemon/inotify.c
index 8bb8ed2..2f22f52 100644
--- a/daemon/inotify.c
+++ b/daemon/inotify.c
@@ -129,7 +129,7 @@ do_inotify_add_watch (char *path, int mask)
char *buf;
NEED_INOTIFY (-1);
- ABS_PATH (path, -1);
+ ABS_PATH (path, return -1);
buf = sysroot_path (path);
if (!buf) {
diff --git a/daemon/link.c b/daemon/link.c
index 29ae679..bf616ed 100644
--- a/daemon/link.c
+++ b/daemon/link.c
@@ -35,7 +35,7 @@ do_readlink (char *path)
char link[PATH_MAX];
NEED_ROOT (NULL);
- ABS_PATH (path, NULL);
+ ABS_PATH (path, return NULL);
CHROOT_IN;
r = readlink (path, link, sizeof link);
@@ -63,7 +63,7 @@ _link (const char *flag, int symbolic, const char *target, const char
*linkname)
char *buf_target;
NEED_ROOT (-1);
- ABS_PATH (linkname, -1);
+ ABS_PATH (linkname, return -1);
/* but target does not need to be absolute */
/* Prefix linkname with sysroot. */
diff --git a/daemon/ls.c b/daemon/ls.c
index e2ca55f..8ae150b 100644
--- a/daemon/ls.c
+++ b/daemon/ls.c
@@ -38,7 +38,7 @@ do_ls (char *path)
struct dirent *d;
NEED_ROOT (NULL);
- ABS_PATH (path, NULL);
+ ABS_PATH (path, return NULL);
CHROOT_IN;
dir = opendir (path);
diff --git a/daemon/mknod.c b/daemon/mknod.c
index 315ea7d..ab799cd 100644
--- a/daemon/mknod.c
+++ b/daemon/mknod.c
@@ -36,7 +36,7 @@ do_mknod (int mode, int devmajor, int devminor, char *path)
int r;
NEED_ROOT (-1);
- ABS_PATH (path, -1);
+ ABS_PATH (path, return -1);
CHROOT_IN;
r = mknod (path, mode, makedev (devmajor, devminor));
diff --git a/daemon/mount.c b/daemon/mount.c
index 6c30304..8cf6874 100644
--- a/daemon/mount.c
+++ b/daemon/mount.c
@@ -320,7 +320,7 @@ do_mount_loop (char *file, char *mountpoint)
char *error;
NEED_ROOT (-1);
- ABS_PATH (file, -1);
+ ABS_PATH (file, return -1);
/* We have to prefix /sysroot on both the filename and the mountpoint. */
mp = sysroot_path (mountpoint);
@@ -358,7 +358,7 @@ do_mkmountpoint (char *path)
int r;
/* NEED_ROOT (-1); - we don't want this test for this call. */
- ABS_PATH (path, -1);
+ ABS_PATH (path, return -1);
CHROOT_IN;
r = mkdir (path, 0777);
@@ -383,7 +383,7 @@ do_rmmountpoint (char *path)
int r;
NEED_ROOT (-1);
- ABS_PATH (path, -1);
+ ABS_PATH (path, return -1);
CHROOT_IN;
r = rmdir (path);
diff --git a/daemon/readdir.c b/daemon/readdir.c
index 17fc619..f8f95d2 100644
--- a/daemon/readdir.c
+++ b/daemon/readdir.c
@@ -37,7 +37,7 @@ do_readdir (char *path)
int i;
NEED_ROOT (NULL);
- ABS_PATH (path, NULL);
+ ABS_PATH (path, return NULL);
ret = malloc (sizeof *ret);
if (ret == NULL) {
diff --git a/daemon/realpath.c b/daemon/realpath.c
index 9ab478d..18adc85 100644
--- a/daemon/realpath.c
+++ b/daemon/realpath.c
@@ -33,7 +33,7 @@ do_realpath (char *path)
char *ret;
NEED_ROOT (NULL);
- ABS_PATH (path, NULL);
+ ABS_PATH (path, return NULL);
CHROOT_IN;
ret = realpath (path, NULL);
diff --git a/daemon/scrub.c b/daemon/scrub.c
index 3c22b66..f1601f9 100644
--- a/daemon/scrub.c
+++ b/daemon/scrub.c
@@ -55,7 +55,7 @@ do_scrub_file (char *file)
int r;
NEED_ROOT (-1);
- ABS_PATH (file, -1);
+ ABS_PATH (file, return -1);
/* Make the path relative to /sysroot. */
buf = sysroot_path (file);
@@ -85,7 +85,7 @@ do_scrub_freespace (char *dir)
int r;
NEED_ROOT (-1);
- ABS_PATH (dir, -1);
+ ABS_PATH (dir, return -1);
/* Make the path relative to /sysroot. */
buf = sysroot_path (dir);
diff --git a/daemon/stat.c b/daemon/stat.c
index da360ce..da2d274 100644
--- a/daemon/stat.c
+++ b/daemon/stat.c
@@ -38,7 +38,7 @@ do_stat (char *path)
struct stat statbuf;
NEED_ROOT (NULL);
- ABS_PATH (path, NULL);
+ ABS_PATH (path, return NULL);
CHROOT_IN;
r = stat (path, &statbuf);
@@ -80,7 +80,7 @@ do_lstat (char *path)
struct stat statbuf;
NEED_ROOT (NULL);
- ABS_PATH (path, NULL);
+ ABS_PATH (path, return NULL);
CHROOT_IN;
r = lstat (path, &statbuf);
@@ -122,7 +122,7 @@ do_statvfs (char *path)
struct statvfs statbuf;
NEED_ROOT (NULL);
- ABS_PATH (path, NULL);
+ ABS_PATH (path, return NULL);
CHROOT_IN;
r = statvfs (path, &statbuf);
diff --git a/daemon/strings.c b/daemon/strings.c
index c0e073f..89e04a8 100644
--- a/daemon/strings.c
+++ b/daemon/strings.c
@@ -34,7 +34,7 @@ do_strings_e (char *encoding, char *path)
char **lines;
NEED_ROOT (NULL);
- ABS_PATH (path, NULL);
+ ABS_PATH (path, return NULL);
buf = sysroot_path (path);
if (!buf) {
diff --git a/daemon/swap.c b/daemon/swap.c
index c9104e1..bb1706f 100644
--- a/daemon/swap.c
+++ b/daemon/swap.c
@@ -80,7 +80,7 @@ do_mkswap_file (char *path)
int r;
NEED_ROOT (-1);
- ABS_PATH (path, -1);
+ ABS_PATH (path, return -1);
buf = sysroot_path (path);
if (!buf) {
@@ -138,7 +138,7 @@ do_swapon_file (char *path)
int r;
NEED_ROOT (-1);
- ABS_PATH (path, -1);
+ ABS_PATH (path, return -1);
buf = sysroot_path (path);
if (!buf) {
@@ -158,7 +158,7 @@ do_swapoff_file (char *path)
int r;
NEED_ROOT (-1);
- ABS_PATH (path, -1);
+ ABS_PATH (path, return -1);
buf = sysroot_path (path);
if (!buf) {
diff --git a/daemon/tar.c b/daemon/tar.c
index 39b983c..e1ff9b6 100644
--- a/daemon/tar.c
+++ b/daemon/tar.c
@@ -107,7 +107,7 @@ do_tar_out (char *dir)
char buf[GUESTFS_MAX_CHUNK_SIZE];
NEED_ROOT (-1);
- ABS_PATH (dir, -1);
+ ABS_PATH (dir, return -1);
/* "tar -C /sysroot%s -cf - ." but we have to quote the dir. */
if (asprintf_nowarn (&cmd, "tar -C %R -cf - .", dir) == -1) {
@@ -229,7 +229,7 @@ do_tgz_out (char *dir)
char buf[GUESTFS_MAX_CHUNK_SIZE];
NEED_ROOT (-1);
- ABS_PATH (dir, -1);
+ ABS_PATH (dir, return -1);
/* "tar -C /sysroot%s -zcf - ." but we have to quote the dir. */
if (asprintf_nowarn (&cmd, "tar -C %R -zcf - .", dir) == -1) {
diff --git a/daemon/wc.c b/daemon/wc.c
index 4878b57..0917eb9 100644
--- a/daemon/wc.c
+++ b/daemon/wc.c
@@ -35,7 +35,7 @@ wc (char *flag, char *path)
int r;
NEED_ROOT (-1);
- ABS_PATH (path, -1);
+ ABS_PATH (path, return -1);
/* Make the path relative to /sysroot. */
buf = sysroot_path (path);
diff --git a/daemon/xattr.c b/daemon/xattr.c
index a908a44..88947b2 100644
--- a/daemon/xattr.c
+++ b/daemon/xattr.c
@@ -117,7 +117,7 @@ getxattrs (char *path,
guestfs_int_xattr_list *r = NULL;
NEED_ROOT (NULL);
- ABS_PATH (path, NULL);
+ ABS_PATH (path, return NULL);
CHROOT_IN;
len = listxattr (path, NULL, 0);
--
1.6.4.337.g5420e