diff options
author | Martin Matuška <martin@matuska.org> | 2020-07-01 18:30:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-01 18:30:20 +0200 |
commit | 0fca2afe9beb20ed85fa7c048e5dd43f4b31aa8d (patch) | |
tree | f45134f7e2ef70e6b8d0b30b93629427e6626788 | |
parent | f3b1f9f239c580b38f4d1197a40c6dde9753672e (diff) | |
parent | 2778b7e7026038313c55935808a0d5a68db1f72a (diff) | |
download | libarchive-0fca2afe9beb20ed85fa7c048e5dd43f4b31aa8d.tar.gz |
Merge pull request #1404 from yuyichao/set_format_error
Set an error message for setting invalid format by code on readers
-rw-r--r-- | libarchive/archive_read_support_format_by_code.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libarchive/archive_read_support_format_by_code.c b/libarchive/archive_read_support_format_by_code.c index 034353d7..81ab770a 100644 --- a/libarchive/archive_read_support_format_by_code.c +++ b/libarchive/archive_read_support_format_by_code.c @@ -26,6 +26,10 @@ #include "archive_platform.h" __FBSDID("$FreeBSD$"); +#ifdef HAVE_ERRNO_H +#include <errno.h> +#endif + #include "archive.h" #include "archive_private.h" @@ -73,5 +77,7 @@ archive_read_support_format_by_code(struct archive *a, int format_code) return archive_read_support_format_zip(a); break; } + archive_set_error(a, ARCHIVE_ERRNO_PROGRAMMER, + "Invalid format code specified"); return (ARCHIVE_FATAL); } |