diff options
author | Sam Ravnborg <sam@mars.ravnborg.org> | 2006-01-28 10:57:26 -0500 |
---|---|---|
committer | Sam Ravnborg <sam@mars.ravnborg.org> | 2006-02-19 03:51:17 -0500 |
commit | cb80514d9c517cc1d101ef304529a0e9b76b4468 (patch) | |
tree | 25c9203d808ce322f13cdf62c98c29bcc49a69be /scripts/mod/sumversion.c | |
parent | 06300b21f4c79fd1578f4b7ca4b314fbab61a383 (diff) |
kbuild: use warn()/fatal() consistent in modpost
modpost.c provides warn() and fatal() - so use them all over the place.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/mod/sumversion.c')
-rw-r--r-- | scripts/mod/sumversion.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c index 43271a1ca01e..5c0754526a26 100644 --- a/scripts/mod/sumversion.c +++ b/scripts/mod/sumversion.c | |||
@@ -316,8 +316,7 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md) | |||
316 | 316 | ||
317 | file = grab_file(cmd, &flen); | 317 | file = grab_file(cmd, &flen); |
318 | if (!file) { | 318 | if (!file) { |
319 | fprintf(stderr, "Warning: could not find %s for %s\n", | 319 | warn("could not find %s for %s\n", cmd, objfile); |
320 | cmd, objfile); | ||
321 | goto out; | 320 | goto out; |
322 | } | 321 | } |
323 | 322 | ||
@@ -355,9 +354,8 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md) | |||
355 | /* Check if this file is in same dir as objfile */ | 354 | /* Check if this file is in same dir as objfile */ |
356 | if ((strstr(line, dir)+strlen(dir)-1) == strrchr(line, '/')) { | 355 | if ((strstr(line, dir)+strlen(dir)-1) == strrchr(line, '/')) { |
357 | if (!parse_file(line, md)) { | 356 | if (!parse_file(line, md)) { |
358 | fprintf(stderr, | 357 | warn("could not open %s: %s\n", |
359 | "Warning: could not open %s: %s\n", | 358 | line, strerror(errno)); |
360 | line, strerror(errno)); | ||
361 | goto out_file; | 359 | goto out_file; |
362 | } | 360 | } |
363 | 361 | ||
@@ -397,23 +395,20 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen) | |||
397 | 395 | ||
398 | file = grab_file(filelist, &len); | 396 | file = grab_file(filelist, &len); |
399 | if (!file) { | 397 | if (!file) { |
400 | fprintf(stderr, "Warning: could not find versions for %s\n", | 398 | warn("could not find versions for %s\n", filelist); |
401 | filelist); | ||
402 | return; | 399 | return; |
403 | } | 400 | } |
404 | 401 | ||
405 | sources = strchr(file, '\n'); | 402 | sources = strchr(file, '\n'); |
406 | if (!sources) { | 403 | if (!sources) { |
407 | fprintf(stderr, "Warning: malformed versions file for %s\n", | 404 | warn("malformed versions file for %s\n", modname); |
408 | modname); | ||
409 | goto release; | 405 | goto release; |
410 | } | 406 | } |
411 | 407 | ||
412 | sources++; | 408 | sources++; |
413 | end = strchr(sources, '\n'); | 409 | end = strchr(sources, '\n'); |
414 | if (!end) { | 410 | if (!end) { |
415 | fprintf(stderr, "Warning: bad ending versions file for %s\n", | 411 | warn("bad ending versions file for %s\n", modname); |
416 | modname); | ||
417 | goto release; | 412 | goto release; |
418 | } | 413 | } |
419 | *end = '\0'; | 414 | *end = '\0'; |
@@ -438,19 +433,19 @@ static void write_version(const char *filename, const char *sum, | |||
438 | 433 | ||
439 | fd = open(filename, O_RDWR); | 434 | fd = open(filename, O_RDWR); |
440 | if (fd < 0) { | 435 | if (fd < 0) { |
441 | fprintf(stderr, "Warning: changing sum in %s failed: %s\n", | 436 | warn("changing sum in %s failed: %s\n", |
442 | filename, strerror(errno)); | 437 | filename, strerror(errno)); |
443 | return; | 438 | return; |
444 | } | 439 | } |
445 | 440 | ||
446 | if (lseek(fd, offset, SEEK_SET) == (off_t)-1) { | 441 | if (lseek(fd, offset, SEEK_SET) == (off_t)-1) { |
447 | fprintf(stderr, "Warning: changing sum in %s:%lu failed: %s\n", | 442 | warn("changing sum in %s:%lu failed: %s\n", |
448 | filename, offset, strerror(errno)); | 443 | filename, offset, strerror(errno)); |
449 | goto out; | 444 | goto out; |
450 | } | 445 | } |
451 | 446 | ||
452 | if (write(fd, sum, strlen(sum)+1) != strlen(sum)+1) { | 447 | if (write(fd, sum, strlen(sum)+1) != strlen(sum)+1) { |
453 | fprintf(stderr, "Warning: writing sum in %s failed: %s\n", | 448 | warn("writing sum in %s failed: %s\n", |
454 | filename, strerror(errno)); | 449 | filename, strerror(errno)); |
455 | goto out; | 450 | goto out; |
456 | } | 451 | } |