summaryrefslogtreecommitdiff
path: root/src/readahead/readahead-analyze.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-06-21 23:58:31 +0200
committerLennart Poettering <lennart@poettering.net>2012-06-21 23:58:31 +0200
commit97fa0e708f33cdd88b2d78a46963bed8dd873697 (patch)
tree00feb93eb602ca348eb30fd359ba5a65451e5613 /src/readahead/readahead-analyze.c
parenta0bbec1ab0493963bacb5364304fa57afbd14277 (diff)
readahead: use log_error() for logging errors
Diffstat (limited to 'src/readahead/readahead-analyze.c')
-rw-r--r--src/readahead/readahead-analyze.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/readahead/readahead-analyze.c b/src/readahead/readahead-analyze.c
index 9c328a5f58..42bf9dbac9 100644
--- a/src/readahead/readahead-analyze.c
+++ b/src/readahead/readahead-analyze.c
@@ -49,24 +49,24 @@ int main_analyze(const char *pack_path)
if (!pack_path)
pack_path = "/.readahead";
- pack = fopen(pack_path, "r");
+ pack = fopen(pack_path, "re");
if (!pack) {
- fprintf(stderr, "Pack file missing\n");
+ log_error("Pack file missing.");
return EXIT_FAILURE;
}
- if (!(fgets(line, sizeof(line), pack))) {
- fprintf(stderr, "Pack file corrupt\n");
+ if (!fgets(line, sizeof(line), pack)) {
+ log_error("Pack file corrupt.");
return EXIT_FAILURE;
}
if (!strstr(line, READAHEAD_PACK_FILE_VERSION)) {
- fprintf(stderr, "Pack file version incompatible with this parser\n");
+ log_error("Pack file version incompatible with this parser.");
return EXIT_FAILURE;
}
if ((a = getc(pack)) == EOF) {
- fprintf(stderr, "Pack file corrupt\n");
+ log_error("Pack file corrupt.");
return EXIT_FAILURE;
}
@@ -83,14 +83,14 @@ int main_analyze(const char *pack_path)
path[strlen(path)-1] = 0;
if (fread(&inode, sizeof(inode), 1, pack) != 1) {
- fprintf(stderr, "Pack file corrupt\n");
+ log_error("Pack file corrupt.");
return EXIT_FAILURE;
}
while (true) {
if (fread(&b, sizeof(b), 1, pack) != 1 ||
fread(&c, sizeof(c), 1, pack) != 1) {
- fprintf(stderr, "Pack file corrupt\n");
+ log_error("Pack file corrupt.");
return EXIT_FAILURE;
}
if ((b == 0) && (c == 0))