1.1 --- a/librazor/atomic-emulate.c Thu Feb 09 20:42:08 2012 +0000
1.2 +++ b/librazor/atomic-emulate.c Thu Feb 16 17:33:47 2012 +0000
1.3 @@ -21,6 +21,7 @@
1.4 #if ENABLE_ATOMIC && !HAVE_WINDOWS_KTM
1.5
1.6 #include <stdlib.h>
1.7 +#include <stdio.h>
1.8 #include <string.h>
1.9 #include <unistd.h>
1.10 #include <sys/types.h>
1.11 @@ -108,7 +109,7 @@
1.12 atomic->toplevel = NULL;
1.13 }
1.14
1.15 - return !!atomic->error_str;
1.16 + return razor_atomic_in_error_state(atomic);
1.17 }
1.18
1.19 RAZOR_EXPORT void razor_atomic_destroy(struct razor_atomic *atomic)
1.20 @@ -119,9 +120,9 @@
1.21 atomic->toplevel = NULL;
1.22 }
1.23
1.24 - free(atomic->error_path);
1.25 - free(atomic->error_str);
1.26 - free(atomic->error_msg);
1.27 + if (atomic->error)
1.28 + razor_error_free(atomic->error);
1.29 +
1.30 free(atomic);
1.31 }
1.32
1.33 @@ -210,8 +211,9 @@
1.34
1.35 return 0;
1.36 #else
1.37 - razor_atomic_set_error_str(atomic, NULL, "Symbolic links not supported "
1.38 - "on this platform");
1.39 + atomic->error = razor_error_new_str(NULL,
1.40 + "Symbolic links not supported "
1.41 + "on this platform");
1.42
1.43 return -1;
1.44 #endif
1.45 @@ -228,13 +230,12 @@
1.46 if (razor_atomic_in_error_state(atomic))
1.47 return -1;
1.48
1.49 - atomic->error_path = strdup(filename);
1.50 tmpnam = atomic_action_attic_tmpnam(atomic);
1.51 fd = open(tmpnam, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
1.52 mode & (S_IRWXU | S_IRWXG | S_IRWXO));
1.53
1.54 if (fd == -1)
1.55 - razor_atomic_set_error_str(atomic, NULL, strerror(errno));
1.56 + atomic->error = razor_error_new_str(filename, strerror(errno));
1.57 else {
1.58 a = atomic_action_new(ACTION_MOVE);
1.59 a->args.path = tmpnam;