diff -r d0aa9e0a6d04 -r fe27cdbd76f2 librazor/atomic-emulate.c --- a/librazor/atomic-emulate.c Thu Feb 09 20:42:08 2012 +0000 +++ b/librazor/atomic-emulate.c Fri Mar 23 20:24:09 2012 +0000 @@ -21,6 +21,7 @@ #if ENABLE_ATOMIC && !HAVE_WINDOWS_KTM #include +#include #include #include #include @@ -108,7 +109,7 @@ atomic->toplevel = NULL; } - return !!atomic->error_str; + return razor_atomic_in_error_state(atomic); } RAZOR_EXPORT void razor_atomic_destroy(struct razor_atomic *atomic) @@ -119,9 +120,9 @@ atomic->toplevel = NULL; } - free(atomic->error_path); - free(atomic->error_str); - free(atomic->error_msg); + if (atomic->error) + razor_error_free(atomic->error); + free(atomic); } @@ -210,8 +211,9 @@ return 0; #else - razor_atomic_set_error_str(atomic, NULL, "Symbolic links not supported " - "on this platform"); + atomic->error = razor_error_new_str(NULL, + "Symbolic links not supported " + "on this platform"); return -1; #endif @@ -228,13 +230,12 @@ if (razor_atomic_in_error_state(atomic)) return -1; - atomic->error_path = strdup(filename); tmpnam = atomic_action_attic_tmpnam(atomic); fd = open(tmpnam, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, mode & (S_IRWXU | S_IRWXG | S_IRWXO)); if (fd == -1) - razor_atomic_set_error_str(atomic, NULL, strerror(errno)); + atomic->error = razor_error_new_str(filename, strerror(errno)); else { a = atomic_action_new(ACTION_MOVE); a->args.path = tmpnam;