libstorage / libstoragemgmt

A library for storage management
https://libstorage.github.io/libstoragemgmt-doc/
GNU Lesser General Public License v2.1
82 stars 32 forks source link

Correct failure to build on i386 #506

Closed tasleson closed 2 years ago

tasleson commented 2 years ago

Newer versions of gcc apparently don't like string lengths that are determined at runtime and will emit a warning when they occur.

lsm_local_disk.c:1102:41: error: '%s' directive writing up to 2147483641 bytes into a region of size 2147483636 [-Werror=format-overflow=] 1102 | sprintf(sysfs_sas_path, "/sys/block/%s/device/sas_address", blk_name);

A discussion: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104746

In our case we know that the string length will safely be smaller than PATH_MAX, so we are simply replacing an unknown at compile time with a known, so that we don't encounter this warning.

At the moment I'm not sure why this is only raised on i386.

Signed-off-by: Tony Asleson tasleson@redhat.com