mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-21 07:26:29 -05:00
Differentiate messages in the log files if they are caused by an hardware issue
This commit is contained in:
parent
85f3f0217c
commit
d3f7bf64c1
33 changed files with 934 additions and 886 deletions
|
|
@ -151,7 +151,7 @@ void cmd_generate_file(const char* path, int size)
|
|||
if (remove(path) != 0) {
|
||||
if (errno != ENOENT) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error removing file %s\n", path);
|
||||
log_fatal(errno, "Error removing file %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
@ -173,21 +173,21 @@ void cmd_generate_file(const char* path, int size)
|
|||
f = open(path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_NOFOLLOW, 0600);
|
||||
if (f < 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error creating file %s\n", path);
|
||||
log_fatal(errno, "Error creating file %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (write(f, data, size) != size) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error writing file %s\n", path);
|
||||
log_fatal(errno, "Error writing file %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (close(f) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error closing file %s\n", path);
|
||||
log_fatal(errno, "Error closing file %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
@ -205,7 +205,7 @@ void cmd_generate_symlink(const char* path, const char* linkto)
|
|||
if (remove(path) != 0) {
|
||||
if (errno != ENOENT) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error removing file %s\n", path);
|
||||
log_fatal(errno, "Error removing file %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
@ -213,7 +213,7 @@ void cmd_generate_symlink(const char* path, const char* linkto)
|
|||
|
||||
if (symlink(linkto, path) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error writing symlink %s\n", path);
|
||||
log_fatal(errno, "Error writing symlink %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
@ -238,7 +238,7 @@ void cmd_generate(int disk, int size)
|
|||
if (mkdir(path, 0777) != 0) {
|
||||
if (errno != EEXIST) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error creating directory %s\n", path);
|
||||
log_fatal(errno, "Error creating directory %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
@ -296,7 +296,7 @@ void cmd_write(const char* path, int size)
|
|||
|
||||
if (lstat(path, &st) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error accessing %s\n", path);
|
||||
log_fatal(errno, "Error accessing %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
@ -323,28 +323,28 @@ void cmd_write(const char* path, int size)
|
|||
f = open(path, O_WRONLY | O_BINARY | O_NOFOLLOW);
|
||||
if (f < 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error creating file %s\n", path);
|
||||
log_fatal(errno, "Error creating file %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (lseek(f, off, SEEK_SET) != off) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error seeking file %s\n", path);
|
||||
log_fatal(errno, "Error seeking file %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (write(f, data, size) != size) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error writing file %s\n", path);
|
||||
log_fatal(errno, "Error writing file %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (close(f) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error closing file %s\n", path);
|
||||
log_fatal(errno, "Error closing file %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
@ -372,7 +372,7 @@ void cmd_damage(const char* path, int size)
|
|||
|
||||
if (lstat(path, &st) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error accessing %s\n", path);
|
||||
log_fatal(errno, "Error accessing %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
@ -400,21 +400,21 @@ void cmd_damage(const char* path, int size)
|
|||
f = open(path, O_RDWR | O_BINARY | O_NOFOLLOW);
|
||||
if (f < 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error creating file %s\n", path);
|
||||
log_fatal(errno, "Error creating file %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (lseek(f, off, SEEK_SET) != off) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error seeking file %s\n", path);
|
||||
log_fatal(errno, "Error seeking file %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (read(f, data, size) != size) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error writing file %s\n", path);
|
||||
log_fatal(errno, "Error writing file %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
@ -423,28 +423,28 @@ void cmd_damage(const char* path, int size)
|
|||
|
||||
if (lseek(f, off, SEEK_SET) != off) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error seeking file %s\n", path);
|
||||
log_fatal(errno, "Error seeking file %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (write(f, data, size) != size) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error writing file %s\n", path);
|
||||
log_fatal(errno, "Error writing file %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (fallback(f, &st) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error setting time for file %s\n", path);
|
||||
log_fatal(errno, "Error setting time for file %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (close(f) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error closing file %s\n", path);
|
||||
log_fatal(errno, "Error closing file %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
@ -464,7 +464,7 @@ void cmd_append(const char* path, int size)
|
|||
|
||||
if (lstat(path, &st) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error accessing %s\n", path);
|
||||
log_fatal(errno, "Error accessing %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
@ -480,21 +480,21 @@ void cmd_append(const char* path, int size)
|
|||
f = open(path, O_WRONLY | O_APPEND | O_BINARY | O_NOFOLLOW);
|
||||
if (f < 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error opening file %s\n", path);
|
||||
log_fatal(errno, "Error opening file %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (write(f, data, size) != size) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error writing file %s\n", path);
|
||||
log_fatal(errno, "Error writing file %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (close(f) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error closing file %s\n", path);
|
||||
log_fatal(errno, "Error closing file %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
@ -515,7 +515,7 @@ void cmd_truncate(const char* path, int size)
|
|||
|
||||
if (lstat(path, &st) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error accessing %s\n", path);
|
||||
log_fatal(errno, "Error accessing %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
@ -538,21 +538,21 @@ void cmd_truncate(const char* path, int size)
|
|||
f = open(path, O_WRONLY | O_BINARY | O_NOFOLLOW);
|
||||
if (f < 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error opening file %s\n", path);
|
||||
log_fatal(errno, "Error opening file %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (ftruncate(f, off) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error truncating file %s\n", path);
|
||||
log_fatal(errno, "Error truncating file %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (close(f) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error closing file %s\n", path);
|
||||
log_fatal(errno, "Error closing file %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
@ -567,7 +567,7 @@ void cmd_delete(const char* path)
|
|||
{
|
||||
if (remove(path) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error removing %s\n", path);
|
||||
log_fatal(errno, "Error removing %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
@ -586,7 +586,7 @@ void cmd_change(const char* path, int size)
|
|||
|
||||
if (lstat(path, &st) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error accessing %s\n", path);
|
||||
log_fatal(errno, "Error accessing %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
@ -597,7 +597,7 @@ void cmd_change(const char* path, int size)
|
|||
/* delete */
|
||||
if (remove(path) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error removing %s\n", path);
|
||||
log_fatal(errno, "Error removing %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
@ -607,7 +607,7 @@ void cmd_change(const char* path, int size)
|
|||
|
||||
if (remove(path) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error removing %s\n", path);
|
||||
log_fatal(errno, "Error removing %s\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue