Diagnostic Biobuf was initialised too late to catch output file creat [sic] errors. Added a %r to give the OS's reason, nice on plan9 but perhaps too much of a portability hit for some. -Steve Reference: /n/sources/patch/applied/8c-op-file-error Date: Thu Sep 7 15:30:31 CES 2006 Signed-off-by: steve@quintile.net --- /sys/src/cmd/cc/lex.c Thu Sep 7 15:28:38 2006 +++ /sys/src/cmd/cc/lex.c Thu Sep 7 15:28:26 2006 @@ -157,6 +157,7 @@ include[0] = strdup(ofile); } else p = ofile; + if(outfile == 0) { outfile = p; if(outfile) { @@ -186,6 +187,7 @@ setinclude("/sys/include"); } } + Binit(&diagbuf, 1, OWRITE); if((debug['a'] || debug['Z']) && !debug['n']) { outfile = 0; Binit(&outbuf, dup(1, -1), OWRITE); @@ -193,13 +195,12 @@ } else { c = mycreat(outfile, 0664); if(c < 0) { - diag(Z, "cannot open %s", outfile); + diag(Z, "cannot open %s - %r", outfile); outfile = 0; errorexit(); } Binit(&outbuf, c, OWRITE); } - Binit(&diagbuf, 1, OWRITE); newio(); /* Use an ANSI preprocessor */