Skip to content

Commit

Permalink
Also set errno for unsupported compressions in solv_xfopen_fd()
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe committed May 16, 2024
1 parent 563c233 commit 4e0b432
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions ext/solv_xfopen.c
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,10 @@ solv_xfopen_fd(const char *fn, int fd, const char *mode)
return mygzfdopen(fd, simplemode);
#else
if (suf && !strcmp(suf, ".gz"))
return 0;
{
errno = ENOTSUP;
return 0;
}
#endif
#ifdef ENABLE_LZMA_COMPRESSION
if (suf && !strcmp(suf, ".xz"))
Expand All @@ -773,9 +776,15 @@ solv_xfopen_fd(const char *fn, int fd, const char *mode)
return mylzfdopen(fd, simplemode);
#else
if (suf && !strcmp(suf, ".xz"))
return 0;
{
errno = ENOTSUP;
return 0;
}
if (suf && !strcmp(suf, ".lzma"))
return 0;
{
errno = ENOTSUP;
return 0;
}
#endif
#ifdef ENABLE_BZIP2_COMPRESSION
if (suf && !strcmp(suf, ".bz2"))
Expand All @@ -789,14 +798,20 @@ solv_xfopen_fd(const char *fn, int fd, const char *mode)
return myzstdfdopen(fd, simplemode);
#else
if (suf && !strcmp(suf, ".zst"))
return 0;
{
errno = ENOTSUP;
return 0;
}
#endif
#ifdef ENABLE_ZCHUNK_COMPRESSION
if (suf && !strcmp(suf, ".zck"))
return myzchunkfdopen(fd, simplemode);
#else
if (suf && !strcmp(suf, ".zck"))
return 0;
{
errno = ENOTSUP;
return 0;
}
#endif
return fdopen(fd, mode);
}
Expand Down

0 comments on commit 4e0b432

Please sign in to comment.