summaryrefslogtreecommitdiff
path: root/src/basic/copy.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-04-29 14:21:22 +0200
committerLennart Poettering <lennart@poettering.net>2016-04-29 14:28:03 +0200
commit0e2b2caccde55ba777b84d667d19541a82c3f3a3 (patch)
tree52cf8a49ea5ebb4cf474540809ad0f045d4a18cc /src/basic/copy.c
parent14e2baa369b120788322e727ecdd249127a13fa1 (diff)
copy: also copy AF_UNIX sockets
We previously would fail with EOPNOTSUPP when encountering an AF_UNIX socket in the directory tree to copy. Fix that, and copy them too (even if they are dead in the result). Fixes: #2914
Diffstat (limited to 'src/basic/copy.c')
-rw-r--r--src/basic/copy.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/basic/copy.c b/src/basic/copy.c
index 03487a6878..3001234a01 100644
--- a/src/basic/copy.c
+++ b/src/basic/copy.c
@@ -364,7 +364,7 @@ static int fd_copy_directory(
q = fd_copy_symlink(dirfd(d), de->d_name, &buf, fdt, de->d_name);
else if (S_ISFIFO(buf.st_mode))
q = fd_copy_fifo(dirfd(d), de->d_name, &buf, fdt, de->d_name);
- else if (S_ISBLK(buf.st_mode) || S_ISCHR(buf.st_mode))
+ else if (S_ISBLK(buf.st_mode) || S_ISCHR(buf.st_mode) || S_ISSOCK(buf.st_mode))
q = fd_copy_node(dirfd(d), de->d_name, &buf, fdt, de->d_name);
else
q = -EOPNOTSUPP;
@@ -396,7 +396,7 @@ int copy_tree_at(int fdf, const char *from, int fdt, const char *to, bool merge)
return fd_copy_symlink(fdf, from, &st, fdt, to);
else if (S_ISFIFO(st.st_mode))
return fd_copy_fifo(fdf, from, &st, fdt, to);
- else if (S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode))
+ else if (S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode) || S_ISSOCK(st.st_mode))
return fd_copy_node(fdf, from, &st, fdt, to);
else
return -EOPNOTSUPP;