elgarfo / mintty

Automatically exported from code.google.com/p/mintty
GNU General Public License v3.0
0 stars 0 forks source link

config->output SIGSEGV when printer spooler services is stopped #168

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. net stop spooler
2. mintty
3. menu->options->output

What is the expected output? What do you see instead?
expected: keep running
actual: SIGSEGV

What version of the product are you using? On what operating system?
mintty 0.5.8 on cygwin 1.7 on windows xp

Please provide any additional information below.

patch:
$ svn di
Index: winprint.c
===================================================================
--- winprint.c  (revision 775)
+++ winprint.c  (working copy)
@@ -26,7 +26,9 @@
   * we'll need for the output. Discard the return value since it
   * will almost certainly be a failure due to lack of space.
   */
-  EnumPrinters(param, null, level, buffer + offset, 512, &needed, &nprinters);
+  if (!EnumPrinters(param, null, level, buffer + offset, 512, &needed,
&nprinters)) {
+    return NULL;
+  }

   if (needed < 512)
     needed = 512;

explains:
when printer spooler is stopped, EnumPrinters returns false, and i fyou
call GetLastError() you'll get 1722, net helpmsg 1722 -> 'RPC server is
unavailable'
in this case, variable "needed" is not initialized, nor does "nprinters".
so simply return NULL in this case

Original issue reported on code.google.com by xue...@gmail.com on 4 Mar 2010 at 12:12

GoogleCodeExporter commented 9 years ago
Dup of issue 149. Thanks for the additional detail though.

Original comment by andy.koppe on 4 Mar 2010 at 1:17