librazor/atomic-actions.c
changeset 440 48204dea0b9f
parent 416 d0aa9e0a6d04
child 444 a2908416b7cc
     1.1 --- a/librazor/atomic-actions.c	Thu Feb 09 20:42:08 2012 +0000
     1.2 +++ b/librazor/atomic-actions.c	Sat Aug 23 11:13:48 2014 +0100
     1.3 @@ -259,9 +259,9 @@
     1.4  		return 0;
     1.5  
     1.6  	if (errno != EEXIST || chmod(action->args.path, mode) < 0) {
     1.7 -		if (!atomic->error_str)
     1.8 -			razor_atomic_set_error_str(atomic, action->args.path,
     1.9 -						   strerror(errno));
    1.10 +		if (!atomic->error)
    1.11 +			atomic->error = razor_error_new_str(action->args.path,
    1.12 +							    strerror(errno));
    1.13  		atomic_action_free(action);
    1.14  		return NULL;
    1.15  	}
    1.16 @@ -278,9 +278,9 @@
    1.17  	}
    1.18  
    1.19  	if (rmdir(action->args.path) < 0) {
    1.20 -		if (!atomic->error_str)
    1.21 -			razor_atomic_set_error_str(atomic, action->args.path,
    1.22 -						   strerror(errno));
    1.23 +		if (!atomic->error)
    1.24 +			atomic->error = razor_error_new_str(action->args.path,
    1.25 +							    strerror(errno));
    1.26  		atomic_action_free(action);
    1.27  		return NULL;
    1.28  	} else
    1.29 @@ -301,9 +301,9 @@
    1.30  
    1.31  	r = symlink(action->args.u.create_symlink.target, action->args.path);
    1.32  	if (r < 0) {
    1.33 -		if (!atomic->error_str)
    1.34 -			razor_atomic_set_error_str(atomic, NULL,
    1.35 -						   strerror(errno));
    1.36 +		if (!atomic->error)
    1.37 +			atomic->error = razor_error_new_str(action->args.path,
    1.38 +							    strerror(errno));
    1.39  		atomic_action_free(action);
    1.40  		return NULL;
    1.41  	}
    1.42 @@ -321,9 +321,9 @@
    1.43  	}
    1.44  
    1.45  	if (unlink(action->args.path) < 0) {
    1.46 -		if (!atomic->error_str)
    1.47 -			razor_atomic_set_error_str(atomic, NULL,
    1.48 -						   strerror(errno));
    1.49 +		if (!atomic->error)
    1.50 +			atomic->error = razor_error_new_str(action->args.path,
    1.51 +							    strerror(errno));
    1.52  		atomic_action_free(action);
    1.53  		return NULL;
    1.54  	}
    1.55 @@ -351,9 +351,9 @@
    1.56  	(void)RemoveDirectoryW(newbuf);
    1.57  
    1.58  	if (!MoveFileExW(oldbuf, newbuf, flags)) {
    1.59 -		if (!atomic->error_str)
    1.60 -			razor_atomic_set_error_mswin(atomic, newbuf,
    1.61 -						     GetLastError());
    1.62 +		if (!atomic->error)
    1.63 +			atomic->error = razor_error_new_mswin(newbuf,
    1.64 +							      GetLastError());
    1.65  		return -1;
    1.66  	}
    1.67  
    1.68 @@ -361,9 +361,9 @@
    1.69  	free(oldbuf);
    1.70  #else
    1.71  	if (rename(path, dest)) {
    1.72 -		if (!atomic->error_str)
    1.73 -			razor_atomic_set_error_str(atomic, dest,
    1.74 -						   strerror(errno));
    1.75 +		if (!atomic->error)
    1.76 +			atomic->error = razor_error_new_str(dest,
    1.77 +							    strerror(errno));
    1.78  		return -1;
    1.79  	}
    1.80  #endif