mirror_zfs/lib/libzfs
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
..
os FreeBSD: do_mount() passes wrong string length to helper 2022-11-18 11:34:25 -08:00
.gitignore Clean up lib dependencies 2020-07-10 14:26:00 -07:00
libzfs_changelist.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libzfs_config.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libzfs_crypto.c Enable -Wwrite-strings 2022-06-29 14:08:54 -07:00
libzfs_dataset.c Do not pass -1 to strerror() from zfs_send_cb_impl() 2022-12-08 14:15:27 -08:00
libzfs_diff.c Cleanup: Address Clang's static analyzer's unused code complaints 2022-10-14 13:37:54 -07:00
libzfs_impl.h Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libzfs_import.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libzfs_iter.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libzfs_mount.c Make zfs-share service resilient to stale exports 2022-09-09 10:54:16 -07:00
libzfs_pool.c Make 1-bit bitfields unsigned 2022-11-03 10:16:16 -07:00
libzfs_sendrecv.c Do not pass -1 to strerror() from zfs_send_cb_impl() 2022-12-08 14:15:27 -08:00
libzfs_status.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libzfs_util.c Cleanup: Address Clang's static analyzer's unused code complaints 2022-10-14 13:37:54 -07:00
libzfs.abi Allow to control failfast 2022-11-10 13:37:12 -08:00
libzfs.pc.in Spruce up pkg-config files for libzfs/libzfs_core 2020-09-04 11:11:18 -07:00
libzfs.suppr Library ABI tracking with abigail 2020-11-17 09:18:52 -08:00
Makefile.am Replace EXTRA_DIST with dist_noinst_DATA 2022-05-26 09:24:50 -07:00
THIRDPARTYLICENSE.openssl Fix typos in lib/ 2019-09-02 17:53:27 -07:00
THIRDPARTYLICENSE.openssl.descrip Encryption patch follow-up 2017-10-11 16:54:48 -04:00