]> git.ipfire.org Git - thirdparty/systemd.git/commit
basic/tmpfile: avoid maybe-uninitialized warning in mkostemp_safe()
authorThomas Haller <thaller@redhat.com>
Sun, 15 Dec 2019 14:50:43 +0000 (15:50 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 16 Dec 2019 13:25:31 +0000 (14:25 +0100)
commite40b4caa1f913702ac94d7a810a767400d347db5
tree194d569086f7a723bb2abbf759a1d4698feaf36a
parentcb180b09fab09326f36697099c559029304ccb4b
basic/tmpfile: avoid maybe-uninitialized warning in mkostemp_safe()

The variable is always initialized, but the compiler might not notice
that. With gcc-9.2.1-1.fc31:

    $ CFLAGS='-Werror=maybe-uninitialized -Og' meson build
    $ ninja -C build
    [...]
    ../src/basic/tmpfile-util.c: In function ‘mkostemp_safe’:
    ../src/basic/tmpfile-util.c:76:12: error: ‘fd’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
       76 |         if (fd < 0)
          |            ^
src/basic/tmpfile-util.c