summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmds-send.c8
-rw-r--r--cmds-subvolume.c6
2 files changed, 12 insertions, 2 deletions
diff --git a/cmds-send.c b/cmds-send.c
index 81b3e496..39110e70 100644
--- a/cmds-send.c
+++ b/cmds-send.c
@@ -63,6 +63,7 @@ int find_mount_root(const char *path, char **mount_root)
int fd;
struct mntent *ent;
int len;
+ int ret;
int longest_matchlen = 0;
char *longest_match = NULL;
@@ -95,10 +96,13 @@ int find_mount_root(const char *path, char **mount_root)
return -ENOENT;
}
+ ret = 0;
*mount_root = realpath(longest_match, NULL);
- free(longest_match);
+ if (!mount_root)
+ ret = -errno;
- return 0;
+ free(longest_match);
+ return ret;
}
static int get_root_id(struct btrfs_send *s, const char *path, u64 *root_id)
diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index 8832303c..63c708ef 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -236,6 +236,12 @@ again:
}
cpath = realpath(path, NULL);
+ if (!cpath) {
+ ret = errno;
+ fprintf(stderr, "ERROR: finding real path for '%s': %s\n",
+ path, strerror(errno));
+ goto out;
+ }
dupdname = strdup(cpath);
dname = dirname(dupdname);
dupvname = strdup(cpath);