main: Use type int for getopt return value
The signedness of char differs from platform to platform; to portably compare the return value from getopt_long to -1, we have to store it in an int. This fixes an infinite loop on powerpc where char is an unsigned char.
+1 −1 · 1 file changed
-
main.cc+1 −1
@@ -1145,7 +1145,7 @@ std::string Main::parse_args_and_init_gtk() { {0,0,0,0} }; std::string display; - char opt; + int opt; // parse --display here, before Gtk::Main(...) takes it away from us opterr = 0; while ((opt = getopt_long(argc, argv, "gh", long_opts1, 0)) != -1)