diff options
author | Christian Pointner <equinox@helsinki.at> | 2012-09-25 11:12:27 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2012-09-25 11:12:27 (GMT) |
commit | f03b88e11ce58d7e77a2c43dd8609126d0347fd2 (patch) | |
tree | 75f0819fa31f70508b3077252748715962bc043e /src/file_list.c | |
parent | f2a08b6a4fa298ef7ffa1ab69937b70e05a8131d (diff) |
most fixes for gcc + -Wall and clang
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; |