mirror_zfs/lib
Richard Yao 5f73bbba43 Do not pass -1 to strerror() from zfs_send_cb_impl()
`zfs_send_cb_impl()` calls `dump_filesystems()`, which calls
`dump_filesystem()`, which will return `-1` as an error when
`zfs_open()` returns `NULL`.

This will be passed to `zfs_standard_error()`, which passes it to
`zfs_standard_error_fmt()`, which passes it to `strerror()`.

To fix this, we modify zfs_open() to set `errno` whenever it returns
NULL. Most of the cases already have `errno` set (since they pass it to
`zfs_standard_error_fmt()`, which makes this easy. Then we modify
`dump_filesystem()` to pass `errno` instead of `-1`.

Reported-by: Coverity (CID-1524598)
Reviewed-by: Damian Szuberski <szuberskidamian@gmail.com>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14264
2022-12-08 14:15:27 -08:00
..
libavl cppcheck: explicitly exclude kernel code from userspace checks 2022-05-10 10:20:55 -07:00
libefi Fix multiplication converted to larger type 2022-10-28 09:30:37 -07:00
libicp Introduce BLAKE3 checksums as an OpenZFS feature 2022-06-08 15:55:57 -07:00
libnvpair Fix GCC 12 compilation errors 2022-11-30 13:45:53 -08:00
libshare Ubuntu 22.04 integration: Cppcheck 2022-11-18 11:26:50 -08:00
libspl freebsd: simplify MD isa_defs.h 2022-11-07 15:55:37 -08:00
libtpool Add <limits.h> header 2022-11-28 13:24:17 -08:00
libunicode cppcheck: explicitly exclude kernel code from userspace checks 2022-05-10 10:20:55 -07:00
libuutil libuutil: deobfuscate internal pointers 2022-11-03 09:57:05 -07:00
libzfs Do not pass -1 to strerror() from zfs_send_cb_impl() 2022-12-08 14:15:27 -08:00
libzfs_core Don't leak packed recieved proprties 2022-11-29 09:51:35 -08:00
libzfsbootenv Fix unchecked return values and unused return values 2022-09-23 16:52:03 -07:00
libzpool Add <limits.h> header 2022-11-28 13:24:17 -08:00
libzstd cppcheck: explicitly exclude kernel code from userspace checks 2022-05-10 10:20:55 -07:00
libzutil Aligned free for aligned alloc 2022-10-26 15:08:31 -07:00
Makefile.am autoconf: use include directives instead of recursing down lib 2022-05-10 10:18:11 -07:00