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>
This commit is contained in:
Sam Ravnborg 2006-01-28 16:57:26 +01:00
parent 06300b21f4
commit cb80514d9c
4 changed files with 27 additions and 32 deletions

View file

@ -316,8 +316,7 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md)
file = grab_file(cmd, &flen);
if (!file) {
fprintf(stderr, "Warning: could not find %s for %s\n",
cmd, objfile);
warn("could not find %s for %s\n", cmd, objfile);
goto out;
}
@ -355,9 +354,8 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md)
/* Check if this file is in same dir as objfile */
if ((strstr(line, dir)+strlen(dir)-1) == strrchr(line, '/')) {
if (!parse_file(line, md)) {
fprintf(stderr,
"Warning: could not open %s: %s\n",
line, strerror(errno));
warn("could not open %s: %s\n",
line, strerror(errno));
goto out_file;
}
@ -397,23 +395,20 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen)
file = grab_file(filelist, &len);
if (!file) {
fprintf(stderr, "Warning: could not find versions for %s\n",
filelist);
warn("could not find versions for %s\n", filelist);
return;
}
sources = strchr(file, '\n');
if (!sources) {
fprintf(stderr, "Warning: malformed versions file for %s\n",
modname);
warn("malformed versions file for %s\n", modname);
goto release;
}
sources++;
end = strchr(sources, '\n');
if (!end) {
fprintf(stderr, "Warning: bad ending versions file for %s\n",
modname);
warn("bad ending versions file for %s\n", modname);
goto release;
}
*end = '\0';
@ -438,19 +433,19 @@ static void write_version(const char *filename, const char *sum,
fd = open(filename, O_RDWR);
if (fd < 0) {
fprintf(stderr, "Warning: changing sum in %s failed: %s\n",
warn("changing sum in %s failed: %s\n",
filename, strerror(errno));
return;
}
if (lseek(fd, offset, SEEK_SET) == (off_t)-1) {
fprintf(stderr, "Warning: changing sum in %s:%lu failed: %s\n",
warn("changing sum in %s:%lu failed: %s\n",
filename, offset, strerror(errno));
goto out;
}
if (write(fd, sum, strlen(sum)+1) != strlen(sum)+1) {
fprintf(stderr, "Warning: writing sum in %s failed: %s\n",
warn("writing sum in %s failed: %s\n",
filename, strerror(errno));
goto out;
}