-
Notifications
You must be signed in to change notification settings - Fork 584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
modif: fcopy: use lstat when copying directory #5957
modif: fcopy: use lstat when copying directory #5957
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
When copying directories use lstat when reading info about source files.
6fe4908
to
e0afbfb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I just realized that the issue is probably because it is both a
directory and a symlink and the directory test appears before the symlink test.
Does it work with only the following changes?
diff --git a/src/fcopy/main.c b/src/fcopy/main.c
index a56e8a91b..72fb8e01f 100644
--- a/src/fcopy/main.c
+++ b/src/fcopy/main.c
@@ -503,12 +503,12 @@ int main(int argc, char **argv) {
exit(1);
}
- if (S_ISDIR(s.st_mode))
+ if (S_ISLNK(s.st_mode))
+ duplicate_link(src, dest, &s);
+ else if (S_ISDIR(s.st_mode))
duplicate_dir(src, dest, &s);
else if (S_ISREG(s.st_mode))
duplicate_file(src, dest, &s);
- else if (S_ISLNK(s.st_mode))
- duplicate_link(src, dest, &s);
else {
fprintf(stderr, "Error fcopy: src %s is an unsupported type of file\n", src);
exit(1);
In my case the problem was with nvidia driver libs, like |
Ah that makes sense now, I see that there is some code in // copy files
if ((arg_follow_link ? stat : lstat)(src, &s) == -1) {
fprintf(stderr, "Error fcopy: src %s: %s\n", src, strerror(errno));
exit(1);
} Though I'm not sure if it is indeed only intended to apply to the top-level Cc: @netblue30 @smitsohu |
When copying directories use lstat when reading info about source files.
Closes #5378.