IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 6, 2008, 12:50:03 PM (18 years ago)
Author:
eugene
Message:

various minor fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/lib.shell/gprint.c

    r17419 r18426  
    134134  }
    135135
    136   // check the special cases
     136  // check the special cases (do not close old file in these cases)
    137137  if (stream[0].file == stdout) {
    138138    stream[0].file = file;
     
    243243  // we allow the user to set stdout to ERR and stderr to LOG if they want
    244244  if (!strcmp (stream[0].name, "stdout")) {
    245     stream[0].file = stdout;
     245    gprintCloseFile (stream, stdout);
    246246    return;
    247247  }
    248248  if (!strcmp (stream[0].name, "stderr")) {
    249     stream[0].file = stderr;
     249    gprintCloseFile (stream, stderr);
    250250    return;
    251251  }
     
    254254  file = fopen (stream[0].name, "a");
    255255  if (file == NULL) {
     256    // XXX this is a problem: we are leaving open the old file
    256257    fprintf (stderr, "cannot open file %s\n", stream[0].name);
    257258    free (stream[0].name);
    258     stream[0].file = (dest == GP_LOG) ? stdout : stderr;
     259    file = (dest == GP_LOG) ? stdout : stderr;
    259260    stream[0].name = (dest == GP_LOG) ? strcreate ("stdout") : strcreate("stderr");
     261    gprintCloseFile (stream, file);
    260262    return;
    261263  }
Note: See TracChangeset for help on using the changeset viewer.