aboutsummaryrefslogtreecommitdiff
path: root/gdb/ctf.c
diff options
context:
space:
mode:
authorYao Qi <yao@codesourcery.com>2013-03-21 01:08:46 +0000
committerYao Qi <yao@codesourcery.com>2013-03-21 01:08:46 +0000
commitaf307d6a5be2ede3aed5f5ca5d726658605fa783 (patch)
tree78800ae5f3de73910ef891ae2645da55ebdf137c /gdb/ctf.c
parentad061d5d8c434b3f8d17f779945116bde3c21a37 (diff)
downloadgdb-af307d6a5be2ede3aed5f5ca5d726658605fa783.zip
gdb-af307d6a5be2ede3aed5f5ca5d726658605fa783.tar.gz
gdb-af307d6a5be2ede3aed5f5ca5d726658605fa783.tar.bz2
gdb/
* ctf.c: Include "gdb_stat.h". [USE_WIN32API]: New macro 'mkdir'. (ctf_start): Use permission bits macros if they are defined.
Diffstat (limited to 'gdb/ctf.c')
-rw-r--r--gdb/ctf.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/gdb/ctf.c b/gdb/ctf.c
index 117f72a..6b55986f 100644
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -23,6 +23,7 @@
#include "ctf.h"
#include "tracepoint.h"
#include "regcache.h"
+#include "gdb_stat.h"
#include <ctype.h>
@@ -270,6 +271,10 @@ ctf_target_save (struct trace_file_writer *self,
return 0;
}
+#ifdef USE_WIN32API
+#define mkdir(pathname, mode) _mkdir (pathname)
+#endif
+
/* This is the implementation of trace_file_write_ops method
start. It creates the directory DIRNAME, metadata and datastream
in the directory. */
@@ -282,10 +287,21 @@ ctf_start (struct trace_file_writer *self, const char *dirname)
struct ctf_trace_file_writer *writer
= (struct ctf_trace_file_writer *) self;
int i;
+ mode_t hmode = S_IRUSR | S_IWUSR | S_IXUSR
+#ifdef S_IRGRP
+ | S_IRGRP
+#endif
+#ifdef S_IXGRP
+ | S_IXGRP
+#endif
+ | S_IROTH /* Defined in common/gdb_stat.h if not defined. */
+#ifdef S_IXOTH
+ | S_IXOTH
+#endif
+ ;
/* Create DIRNAME. */
- if (mkdir (dirname, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)
- && errno != EEXIST)
+ if (mkdir (dirname, hmode) && errno != EEXIST)
error (_("Unable to open directory '%s' for saving trace data (%s)"),
dirname, safe_strerror (errno));