summaryrefslogtreecommitdiffstats
path: root/libdimension/platform.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdimension/platform.c')
-rw-r--r--libdimension/platform.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libdimension/platform.c b/libdimension/platform.c
index 0317bd5..9ae579a 100644
--- a/libdimension/platform.c
+++ b/libdimension/platform.c
@@ -18,6 +18,11 @@
* <http://www.gnu.org/licenses/>. *
*************************************************************************/
+/**
+ * @file
+ * Platform abstractions.
+ */
+
#include "dimension-impl.h"
#if HAVE_UNISTD_H
#include <unistd.h>
@@ -40,7 +45,10 @@ dmnsn_backtrace(FILE *file)
void *buffer[size];
int nptrs = backtrace(buffer, size);
- backtrace_symbols_fd(buffer, nptrs, fileno(file));
+ int fd = fileno(file);
+ if (fd != -1) {
+ backtrace_symbols_fd(buffer, nptrs, fd);
+ }
#endif
}