Changeset e488ec5 for global.c


Ignore:
Timestamp:
Jul 27, 2010, 10:50:36 PM (11 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.7, release-1.8, release-1.9
Children:
35a30f9
Parents:
f93cc34 (diff), 26ad412 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:
Merge branch 'security'
File:
1 edited

Legend:

Unmodified
Added
Removed
  • global.c

    rd296c9a re488ec5  
    983983                                                       filters[i].desc));
    984984}
     985
     986FILE *owl_global_get_debug_file_handle(owl_global *g) {
     987  static char *open_file = NULL;
     988  const char *filename = owl_global_get_debug_file(g);
     989  if (g->debug_file == NULL ||
     990      (open_file && strcmp(filename, open_file) != 0)) {
     991    char *path;
     992    int fd;
     993
     994    if (g->debug_file)
     995      fclose(g->debug_file);
     996
     997    g->debug_file = NULL;
     998
     999    path = owl_sprintf("%s.%d", filename, getpid());
     1000    fd = open(path, O_CREAT|O_WRONLY|O_EXCL, 0600);
     1001    owl_free(path);
     1002
     1003    if (fd >= 0)
     1004      g->debug_file = fdopen(fd, "a");
     1005
     1006    owl_free(open_file);
     1007    open_file = owl_strdup(filename);
     1008  }
     1009  return g->debug_file;
     1010}
Note: See TracChangeset for help on using the changeset viewer.