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)
| ^
/* This is much like mkostemp() but is subject to umask(). */
int mkostemp_safe(char *pattern) {
- int fd;
+ int fd = -1; /* avoid false maybe-uninitialized warning */
assert(pattern);