diff -r f28bb31024b4 -r 7a38fc77fbde librazor/atomic.c --- a/librazor/atomic.c Wed Aug 20 18:57:59 2014 +0100 +++ b/librazor/atomic.c Wed Jun 08 15:15:27 2016 +0100 @@ -69,10 +69,20 @@ } RAZOR_EXPORT void -razor_atomic_abort(struct razor_atomic *atomic, const char *error_msg) +razor_atomic_abort(struct razor_atomic *atomic, int domain, int code, + const char *error_msg) { if (!atomic->error) - atomic->error = razor_error_new_str(NULL, error_msg); + atomic->error = razor_error_new_str(domain, code, NULL, + error_msg); +} + +RAZOR_EXPORT void +razor_atomic_propagate_error(struct razor_atomic *atomic, + struct razor_error *error, const char *summary) +{ + if (!atomic->error) + atomic->error = razor_error_dup(error, summary); } RAZOR_EXPORT int @@ -121,8 +131,7 @@ while(size) { written = write(fd, data, size); if (written < 0) { - atomic->error = razor_error_new_str(NULL, - strerror(errno)); + atomic->error = razor_error_new_posix(NULL); (void)close(fd); @@ -143,7 +152,7 @@ return -1; if (fsync(handle) < 0) { - atomic->error = razor_error_new_str(NULL, strerror(errno)); + atomic->error = razor_error_new_posix(NULL); return -1; } @@ -157,7 +166,7 @@ return -1; if (close(fd) < 0) { - atomic->error = razor_error_new_str(NULL, strerror(errno)); + atomic->error = razor_error_new_posix(NULL); return -1; }