librazor/atomic-actions.c
changeset 473 2e8a0b26d579
parent 458 3f841a46eab5
child 475 008c75a5e08d
     1.1 --- a/librazor/atomic-actions.c	Fri Oct 17 10:10:57 2014 +0100
     1.2 +++ b/librazor/atomic-actions.c	Sat Jun 11 17:56:45 2016 +0100
     1.3 @@ -365,9 +365,20 @@
     1.4  	free(newbuf);
     1.5  	free(oldbuf);
     1.6  #else
     1.7 +	int code;
     1.8 +	const char *object;
     1.9 +
    1.10  	if (rename(path, dest)) {
    1.11 -		if (!atomic->error)
    1.12 -			atomic->error = razor_error_new_posix(dest);
    1.13 +		if (!atomic->error) {
    1.14 +			code = errno;
    1.15 +			if (access(path, F_OK) < 0)
    1.16 +				object = path;
    1.17 +			else
    1.18 +				object = dest;
    1.19 +			atomic->error = razor_error_new_str(RAZOR_POSIX_ERROR,
    1.20 +							    code, object,
    1.21 +							    strerror(code));
    1.22 +		}
    1.23  		return -1;
    1.24  	}
    1.25  #endif