1 |
commit: dac123cefa79db06f25b64f8f863b85aa2456342 |
2 |
Author: Nick Bowler <nbowler <AT> draconx <DOT> ca> |
3 |
AuthorDate: Sat Mar 30 10:10:31 2019 +0000 |
4 |
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Mar 30 10:11:55 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/elfix.git/commit/?id=dac123ce |
7 |
|
8 |
install-xattr: report any errors by "stat" |
9 |
|
10 |
Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org> |
11 |
|
12 |
misc/install-xattr/checkcopyattrs.sh | 3 +++ |
13 |
misc/install-xattr/install-xattr.c | 8 ++++++-- |
14 |
2 files changed, 9 insertions(+), 2 deletions(-) |
15 |
|
16 |
diff --git a/misc/install-xattr/checkcopyattrs.sh b/misc/install-xattr/checkcopyattrs.sh |
17 |
index 9196795..a9149d7 100755 |
18 |
--- a/misc/install-xattr/checkcopyattrs.sh |
19 |
+++ b/misc/install-xattr/checkcopyattrs.sh |
20 |
@@ -49,6 +49,9 @@ setfattr -n user.pax.flags -v "r" c |
21 |
[ "$(getfattr --only-values -n user.bas f/a)" == "x" ] |
22 |
[ "$(getfattr --only-values -n user.pax.flags f/a)" == "mr" ] |
23 |
|
24 |
+# Check that we can copy large files |
25 |
+truncate -s2G a |
26 |
+./install-xattr a x |
27 |
|
28 |
# The following are just tests to make sure the raw install |
29 |
# options don't get lost in our optargs parsing. |
30 |
|
31 |
diff --git a/misc/install-xattr/install-xattr.c b/misc/install-xattr/install-xattr.c |
32 |
index 0b5eb25..3e20b63 100644 |
33 |
--- a/misc/install-xattr/install-xattr.c |
34 |
+++ b/misc/install-xattr/install-xattr.c |
35 |
@@ -365,8 +365,10 @@ main(int argc, char* argv[]) |
36 |
|
37 |
if (!opts_target_directory) { |
38 |
target = argv[last]; |
39 |
- if (stat(target, &s) != 0) |
40 |
+ if (stat(target, &s) != 0) { |
41 |
+ err(1, "failed to stat %s", target); |
42 |
return EXIT_FAILURE; |
43 |
+ } |
44 |
target_is_directory = S_ISDIR(s.st_mode); |
45 |
} else { |
46 |
/* target was set above with the -t option */ |
47 |
@@ -381,8 +383,10 @@ main(int argc, char* argv[]) |
48 |
last++; |
49 |
|
50 |
for (i = first; i < last; i++) { |
51 |
- if (stat(argv[i], &s) != 0) |
52 |
+ if (stat(argv[i], &s) != 0) { |
53 |
+ err(1, "failed to stat %s", argv[i]); |
54 |
return EXIT_FAILURE; |
55 |
+ } |
56 |
/* We reproduce install's behavior and skip |
57 |
* all extra directories on the command line |
58 |
* that are not the final target directory. |