1.1 --- a/librazor/atomic.c Wed Aug 20 18:57:59 2014 +0100
1.2 +++ b/librazor/atomic.c Fri Apr 15 16:58:07 2016 +0100
1.3 @@ -69,10 +69,20 @@
1.4 }
1.5
1.6 RAZOR_EXPORT void
1.7 -razor_atomic_abort(struct razor_atomic *atomic, const char *error_msg)
1.8 +razor_atomic_abort(struct razor_atomic *atomic, int domain, int code,
1.9 + const char *error_msg)
1.10 {
1.11 if (!atomic->error)
1.12 - atomic->error = razor_error_new_str(NULL, error_msg);
1.13 + atomic->error = razor_error_new_str(domain, code, NULL,
1.14 + error_msg);
1.15 +}
1.16 +
1.17 +RAZOR_EXPORT void
1.18 +razor_atomic_propagate_error(struct razor_atomic *atomic,
1.19 + struct razor_error *error, const char *summary)
1.20 +{
1.21 + if (!atomic->error)
1.22 + atomic->error = razor_error_dup(error, summary);
1.23 }
1.24
1.25 RAZOR_EXPORT int
1.26 @@ -121,8 +131,7 @@
1.27 while(size) {
1.28 written = write(fd, data, size);
1.29 if (written < 0) {
1.30 - atomic->error = razor_error_new_str(NULL,
1.31 - strerror(errno));
1.32 + atomic->error = razor_error_new_posix(NULL);
1.33
1.34 (void)close(fd);
1.35
1.36 @@ -143,7 +152,7 @@
1.37 return -1;
1.38
1.39 if (fsync(handle) < 0) {
1.40 - atomic->error = razor_error_new_str(NULL, strerror(errno));
1.41 + atomic->error = razor_error_new_posix(NULL);
1.42 return -1;
1.43 }
1.44
1.45 @@ -157,7 +166,7 @@
1.46 return -1;
1.47
1.48 if (close(fd) < 0) {
1.49 - atomic->error = razor_error_new_str(NULL, strerror(errno));
1.50 + atomic->error = razor_error_new_posix(NULL);
1.51 return -1;
1.52 }
1.53