Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1510941 > unrolled thread
| Started by | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| First post | 2016-10-28 10:40 +0200 |
| Last post | 2016-10-28 10:40 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 04/10] scripts/basic/fixdep: Fix error log output in print_deps() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-28 10:40 +0200
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-10-28 10:40 +0200 |
| Subject | [PATCH 04/10] scripts/basic/fixdep: Fix error log output in print_deps() |
| Message-ID | <sxaRH-5SO-7@gated-at.bofh.it> |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 27 Oct 2016 19:04:01 +0200
The function "perror" was called after a call of the function "fprintf"
in two if branches. So it could happen that an error message was displayed
for a failed print operation instead of the failure according to the call
of the function "fstat" or "open" here.
* Pass the relevant error data in the logging calls directly.
* Express that the corresponding return values are intentionally unused
by casts to void.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
scripts/basic/fixdep.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index 0dcec29..9a2ff68 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -403,13 +403,15 @@ static void print_deps(void)
fd = open(depfile, O_RDONLY);
if (fd < 0) {
- fprintf(stderr, "fixdep: error opening depfile: ");
- perror(depfile);
+ (void) fprintf(stderr,
+ "fixdep: error opening depfile: %s: %s\n",
+ depfile, strerror(errno));
exit(2);
}
if (fstat(fd, &st) < 0) {
- fprintf(stderr, "fixdep: error fstat'ing depfile: ");
- perror(depfile);
+ (void) fprintf(stderr,
+ "fixdep: error fstat'ing depfile: %s: %s\n",
+ depfile, strerror(errno));
exit(2);
}
if (st.st_size == 0) {
--
2.10.1
Back to top | Article view | linux.kernel
csiph-web