Page MenuHomeFreeBSD

Use int instead of char to take the result of getopt() in ZFS utilities.
AbandonedPublic

Authored by jhibbits on Jun 7 2018, 6:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 1 2024, 12:39 AM
Unknown Object (File)
Dec 25 2023, 2:08 PM
Unknown Object (File)
Nov 30 2023, 5:10 AM
Unknown Object (File)
Nov 10 2023, 6:34 AM
Unknown Object (File)
Nov 2 2023, 11:53 PM
Unknown Object (File)
Aug 14 2023, 9:54 PM
Unknown Object (File)
Jul 20 2023, 8:04 AM
Unknown Object (File)
Mar 21 2023, 11:57 AM
Subscribers

Details

Reviewers
avg
Group Reviewers
ZFS
Summary

on some archs, like PowerPC, char is unsigned by default. This would
result in an infinite loop on powerpc in the getopt() call in this program.
Caught by gcc with the following warning:

/usr/src/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c: In function 'main':
/usr/src/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c:231: warning: comparison is always true due to limited range of data type

Test Plan

compiled only

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 17102
Build 16962: arc lint + arc unit

Event Timeline

avg added a subscriber: avg.

LGTM.
Please consider opening an issue at https://www.illumos.org/projects/illumos-gate/issues even though illumos does not support PowerPC.

This revision is now accepted and ready to land.Jun 7 2018, 7:41 PM

Expand to all ZFS uses found.

This revision now requires review to proceed.Jun 8 2018, 3:42 PM
In D15696#331834, @avg wrote:

LGTM.
Please consider opening an issue at https://www.illumos.org/projects/illumos-gate/issues even though illumos does not support PowerPC.

I intend to do that. I hope I remember my credentials.

jhibbits retitled this revision from Use int instead of char to take the result of getopt() in zstreamdump. to Use int instead of char to take the result of getopt() in ZFS utilities..Jun 10 2018, 5:28 PM

switch to new openzfs made this redundant.