[kbd] [Lint][Bug report] src/openvt.c:386: 'pid' may be used uninitialized
Vladislav Ivanishin
vlad at ispras.ru
Tue Jun 11 21:20:04 MSK 2019
Hi,
I've found this bug using a static analyzer (slightly improved GCC).
Consider variable `pid` in function main from src/openvt.c:
src/openvt.c:166: int opt, pid, i;
src/openvt.c:303: if (direct_exec || ((pid = fork()) == 0)) {
src/openvt.c:386: if (pid < 0)
src/openvt.c:393: waitpid(pid, &retval, 0);
If direct_exec is TRUE, then pid doesn't get initialized, but it is used
outside the conditional regardless of that.
--
Vlad
More information about the kbd
mailing list