Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix service_idle_exit build issue with -Werror=maybe-unitialized #5463

Merged
merged 1 commit into from
Dec 14, 2018
Merged

Fix service_idle_exit build issue with -Werror=maybe-unitialized #5463

merged 1 commit into from
Dec 14, 2018

Conversation

OdyX
Copy link
Contributor

@OdyX OdyX commented Dec 14, 2018

There's only one line that makes the build fail under -Werror=maybe-unitialized :

Compiling listen.c...
cc  -fPIC -g -fstack-protector -D_GNU_SOURCE -I.. -D_CUPS_SOURCE -isystem /usr/include/mit-krb5 -Wdate-time -D_FORTIFY_SOURCE=2 -isystem /usr/include/mit-krb5 -g -O2 -fdebug-prefix-map=/tmp/reprotest.wwqjgR/const_build_path=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -I/usr/include/libusb-1.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -DDBUS_API_SUBJECT_TO_CHANGE -D_FORTIFY_SOURCE=2 -D_REENTRANT -I/usr/include/p11-kit-1 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_THREAD_SAFE -D_REENTRANT  -Werror -Wno-error=deprecated-declarations -Wall -Wno-format-y2k -Wunused -Wno-unused-result -Wsign-conversion -Wno-format-truncation -Wno-tautological-compare -c -o listen.o listen.c
main.c: In function ‘main’:
main.c:942:14: error: ‘service_idle_exit’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
     if (!fds && service_idle_exit)
              ^~

It should be initialized to 0, right?

@michaelrsweet michaelrsweet self-assigned this Dec 14, 2018
@michaelrsweet michaelrsweet added this to the CUPS 2.3.x milestone Dec 14, 2018
@michaelrsweet
Copy link
Collaborator

Gotta love GCC for being honest about not being sure about their warnings... :/

Initializing service_idle_exit to 0 is a safe enough, if unnecessary, change.

@michaelrsweet michaelrsweet merged commit 59e5714 into apple:master Dec 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants