diff options
| author | Florian Fischer <florian.fl.fischer@fau.de> | 2019-08-22 20:00:11 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fl.fischer@fau.de> | 2019-08-22 20:30:10 +0200 |
| commit | 46c9280aff29964db33a8a6c778618af9270e3b2 (patch) | |
| tree | b8ca776f6c5720c582536ba6201db0e9f135920e | |
| parent | 57afdea435e2fb22306d038f52f39852a74c7bdd (diff) | |
| download | allocbench-46c9280aff29964db33a8a6c778618af9270e3b2.tar.gz allocbench-46c9280aff29964db33a8a6c778618af9270e3b2.zip | |
read output file path from CHATTYMALLOC_FILE environment variable
| -rw-r--r-- | src/chattymalloc.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/chattymalloc.c b/src/chattymalloc.c index 679f68f..8614a27 100644 --- a/src/chattymalloc.c +++ b/src/chattymalloc.c @@ -53,7 +53,11 @@ write_output(const char* fmt, ...) static void __attribute__((constructor)) init() { - out = open("chattymalloc.txt", + char* fname = getenv("CHATTYMALLOC_FILE"); + if (fname == NULL) + fname = "chattymalloc.txt"; + + out = open(fname, O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); if (out == -1) { |
