diff options
Diffstat (limited to 'src/file_list.c')
-rw-r--r-- | src/file_list.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/file_list.c b/src/file_list.c index 4d82db7..f3c76fd 100644 --- a/src/file_list.c +++ b/src/file_list.c @@ -22,6 +22,8 @@ * along with rharchive. If not, see <http://www.gnu.org/licenses/>. */ +#define _GNU_SOURCE +#include <unistd.h> #include <string.h> #include <stdlib.h> #include <stdio.h> @@ -77,8 +79,8 @@ file_t* file_list_add(file_list_t* list, struct tm* time, const char* type, cons char name[256]; strftime(name, sizeof(name), format, time); - asprintf(&(tmp->path_), "%s/%s", dir, name); - if(!tmp->path_) { + int len = asprintf(&(tmp->path_), "%s/%s", dir, name); + if(len == -1) { free(tmp); return NULL; } @@ -190,8 +192,8 @@ int open_file(file_t* file) } cnt++; char* tmp; - asprintf(&tmp, "%s.%d", orig_path, cnt); - if(!tmp) { + int len = asprintf(&tmp, "%s.%d", orig_path, cnt); + if(len == -1) { if(orig_path != file->path_) free(orig_path); return -2; |