projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
088875f
)
Terminate source correctly when copying symlink. Report and patch by
author
Matt Kraai
<kraai@debian.org>
Fri, 27 Apr 2001 15:40:27 +0000
(15:40 -0000)
committer
Matt Kraai
<kraai@debian.org>
Fri, 27 Apr 2001 15:40:27 +0000
(15:40 -0000)
Brian Webb <webbb@desertscenes.net>.
libbb/copy_file.c
patch
|
blob
|
history
diff --git
a/libbb/copy_file.c
b/libbb/copy_file.c
index 4ee3efdbc59270140663d5ac0b44356d9c48ce03..6c220022fe37eeab89574f9cae5282b0da08d236 100644
(file)
--- a/
libbb/copy_file.c
+++ b/
libbb/copy_file.c
@@
-200,13
+200,14
@@
int copy_file(const char *source, const char *dest, int flags)
umask(saved_umask);
} else if (S_ISLNK(source_stat.st_mode)) {
+ int size;
char buf[BUFSIZ + 1];
- if (
readlink(source, buf, BUFSIZ
) < 0) {
+ if (
(size = readlink(source, buf, BUFSIZ)
) < 0) {
perror_msg("cannot read `%s'", source);
return -1;
}
- buf[
BUFSIZ
] = '\0';
+ buf[
size
] = '\0';
if (symlink(buf, dest) < 0) {
perror_msg("cannot create symlink `%s'", dest);