IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 6, 2015, 8:10:33 PM (11 years ago)
Author:
eugene
Message:

handle file open failure for stdout,stderr redirect more cleanly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20150625/Ohana/src/opihi/pantasks/pantasks_server.c.in

    r32632 r38573  
    1919 
    2020  char hostname[256], portinfo[256];
    21   char log_stdout[1024], log_stderr[1024];
     21  char log_stdout[1024], log_stderr[1024], tmpname[1024];
    2222  pthread_t JobsAndTasksThread;
    2323  pthread_t clientsThread;
     
    3434  stdin = freopen ("/dev/zero", "r", stdin);
    3535
    36   // this block redirects the actual stderr, stdout steams to the output files
    37   if (VarConfig ("PANTASKS_SERVER_STDOUT", "%s", log_stdout) != NULL) {
     36  // this block redirects the actual stderr, stdout streams to the output files
     37  if (VarConfig ("PANTASKS_SERVER_STDOUT", "%s", tmpname) != NULL) {
     38    strcpy (log_stdout, tmpname);
    3839    if (strcmp (log_stdout, "stdout")) {
    3940      stdout = freopen (log_stdout, "a", stdout);
     
    4445    }
    4546  }
    46   if (VarConfig ("PANTASKS_SERVER_STDERR", "%s", log_stderr) != NULL) {
     47  if (VarConfig ("PANTASKS_SERVER_STDERR", "%s", tmpname) != NULL) {
     48    strcpy (log_stderr, tmpname);
    4749    if (strcmp (log_stderr, "stderr")) {
    4850      stderr = freopen (log_stderr, "a", stderr);
Note: See TracChangeset for help on using the changeset viewer.