diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2019-12-18 13:30:57 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2019-12-18 13:30:57 -0500 |
commit | 3166627f1485e2f05421fe874b2236852fe5d017 (patch) | |
tree | d22a6c9b0e61907d15678146a3298efab1beed5b /archive.c | |
parent | 2be3d5c5d905bd748b8ce511033065fa5a83a59c (diff) | |
download | spmc-3166627f1485e2f05421fe874b2236852fe5d017.tar.gz |
Improved output and error handling
Diffstat (limited to 'archive.c')
-rw-r--r-- | archive.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -14,6 +14,12 @@ int tar_extract_file(const char *archive, const char* filename, const char *dest char cmd[PATH_MAX]; sprintf(cmd, "tar xf %s -C %s %s 2>&1", archive, destination, filename); + if (exists(archive) != 0) { + fprintf(stderr, "%s :: ", archive); + fprintf(SYSERROR); + return -1; + } + shell(&proc, SHELL_OUTPUT, cmd); if (!proc) { fprintf(SYSERROR); @@ -31,6 +37,11 @@ int tar_extract_archive(const char *_archive, const char *_destination) { int status; char cmd[PATH_MAX]; + if (exists(_archive) != 0) { + fprintf(SYSERROR); + return -1; + } + char *archive = strdup(_archive); if (!archive) { fprintf(SYSERROR); |