librazor/atomic.c
changeset 483 8087224f30c4
parent 447 0a5e583393e1
     1.1 --- a/librazor/atomic.c	Tue Sep 09 15:27:12 2014 +0100
     1.2 +++ b/librazor/atomic.c	Fri Jul 08 17:12:16 2016 +0100
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (C) 2011-2012  J. Ali Harlow <ali@juiblex.co.uk>
     1.6 + * Copyright (C) 2011-2012, 2016  J. Ali Harlow <ali@juiblex.co.uk>
     1.7   *
     1.8   * This program is free software; you can redistribute it and/or modify
     1.9   * it under the terms of the GNU General Public License as published by
    1.10 @@ -23,9 +23,6 @@
    1.11  #include <limits.h>
    1.12  #include <errno.h>
    1.13  #include <unistd.h>
    1.14 -#include <sys/types.h>
    1.15 -#include <sys/stat.h>
    1.16 -#include <fcntl.h>
    1.17  #include <string.h>
    1.18  #include <assert.h>
    1.19  
    1.20 @@ -81,8 +78,15 @@
    1.21  razor_atomic_propagate_error(struct razor_atomic *atomic,
    1.22  			     struct razor_error *error, const char *summary)
    1.23  {
    1.24 -	if (!atomic->error)
    1.25 -		atomic->error = razor_error_dup(error, summary);
    1.26 +	if (!atomic->error) {
    1.27 +		if (!summary) {
    1.28 +			atomic->error = error;
    1.29 +			return;
    1.30 +		} else
    1.31 +			atomic->error = razor_error_dup(error, summary);
    1.32 +	}
    1.33 +
    1.34 +	razor_error_free(error);
    1.35  }
    1.36  
    1.37  RAZOR_EXPORT int