This is the mail archive of the cygwin-patches mailing list for the Cygwin project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
As mentioned in <http://cygwin.com/ml/cygwin/2005-08/msg00724.html>, I noticed something strange in the "cygcheck -s" output: /usr/bin/cygrunsrv: Exactly one of --install, --remove, --start, --stop, --query, or --list is required Try `/usr/bin/cygrunsrv --help' for more information. strace shows the following arguments: 106 11167 [main] cygrunsrv 2116 build_argv: argv[0] = 'C:\cygwin\bin\cygrunsrv.exe' 20 11187 [main] cygrunsrv 2116 build_argv: argv[1] = '--query' 19 11206 [main] cygrunsrv 2116 build_argv: argv[2] = 'in\cygrunsrv.exe' 18 11224 [main] cygrunsrv 2116 build_argv: argv[3] = '--list' 18 11242 [main] cygrunsrv 2116 build_argv: argc 4 which is obviously wrong. The attached patch fixes it. No copyright assignment here, but the patch is trivial. Besides the bug, the invocation code has a bit of an inefficiency. The inefficiency is in the following code (in pseudocode, for conciseness): f = popen("cygrunsrv --list"); fread(buf, 1, sizeof(buf), f); pclose(f); for (char *srv = strtok(buf, "\n"); srv; srv = strtok(NULL, "\n")) { if (verbose) f = popen("cygrunsrv --list --verbose"); else ... copy_output(f, stdout); if (verbose) break; } why not simply run "cygrunsrv --list --verbose" in verbose mode, instead of actually going through one iteration of the loop? Simply to reuse the "copy output" code? Brian? Igor ============================================================================== ChangeLog: 2005-08-16 Igor Pechtchanski <pechtcha@cs.nyu.edu> * cygcheck.cc (dump_sysinfo_services): Terminate command output before running strtok(). -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha@cs.nyu.edu ZZZzz /,`.-'`' -. ;-;;,_ igor@watson.ibm.com |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D. '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! If there's any real truth it's that the entire multidimensional infinity of the Universe is almost certainly being run by a bunch of maniacs. /DA
Attachment:
cygcheck-cygrunsrv-fix.patch
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |