]> git.ipfire.org Git - thirdparty/systemd.git/commit
repart: silence bogus gcc warning 26322/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 6 Feb 2023 09:08:44 +0000 (10:08 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 6 Feb 2023 09:24:57 +0000 (10:24 +0100)
commit03f5e501b6b58cb05a275403af4a36694ff0c205
treebbbc8ba970bf882d603de4c016dda3bc36a30c80
parent375ffdba43f6dac5f4b1222d4e345f7cdf868f8c
repart: silence bogus gcc warning

[2/3] Compiling C object systemd-repart.p/src_partition_repart.c.o
../src/partition/repart.c: In function ‘context_open_copy_block_paths’:
../src/partition/repart.c:5194:41: warning: ‘devno’ may be used uninitialized [-Wmaybe-uninitialized]
 5194 |                         source_fd = r = device_open_from_devnum(S_IFBLK, devno, O_RDONLY|O_CLOEXEC|O_NONBLOCK, &opened);
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/partition/repart.c:5188:31: note: ‘devno’ was declared here
 5188 |                         dev_t devno;
      |                               ^~~~~

This is with gcc-13.0.1-0.2.fc38.x86_64, -O2. I'm pretty sure the code
is correct. I also tried adding some asserts where errno is used for the return
value, but that didn't help. I think resolve_copy_blocks_auto() is just too long
for gcc to understand.
src/partition/repart.c