aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-03-04 08:41:27 -0500
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-03-04 08:41:27 -0500
commit674768caa67722992a16fbe1453ce625fa149955 (patch)
tree2b1e6321552fe107a939fdd758683380539a0fcf /src
parenta691ba8c27d71fc4887500abe677a01809727600 (diff)
downloadstasis-674768caa67722992a16fbe1453ce625fa149955.tar.gz
xmkstemp allow setting file mode
* add usage comment function
Diffstat (limited to 'src')
-rw-r--r--src/deliverable.c2
-rw-r--r--src/docker.c2
-rw-r--r--src/system.c2
-rw-r--r--src/utils.c4
4 files changed, 5 insertions, 5 deletions
diff --git a/src/deliverable.c b/src/deliverable.c
index 4397c1c..b935b64 100644
--- a/src/deliverable.c
+++ b/src/deliverable.c
@@ -1215,7 +1215,7 @@ void delivery_rewrite_spec(struct Delivery *ctx, char *filename) {
msg(OMC_MSG_ERROR, "failed to generate release header string\n", filename);
exit(1);
}
- tempfile = xmkstemp(&tp);
+ tempfile = xmkstemp(&tp, "w");
if (!tempfile || !tp) {
msg(OMC_MSG_ERROR, "%s: unable to create temporary file\n", strerror(errno));
exit(1);
diff --git a/src/docker.c b/src/docker.c
index 49d8b08..dafdd58 100644
--- a/src/docker.c
+++ b/src/docker.c
@@ -79,7 +79,7 @@ char *docker_ident() {
char line[PATH_MAX];
struct Process proc;
- tempfile = xmkstemp(&fp);
+ tempfile = xmkstemp(&fp, "w");
if (!fp || !tempfile) {
return NULL;
}
diff --git a/src/system.c b/src/system.c
index 154bd87..17b9a13 100644
--- a/src/system.c
+++ b/src/system.c
@@ -15,7 +15,7 @@ int shell(struct Process *proc, char *args) {
FILE *tp = NULL;
char *t_name;
- t_name = xmkstemp(&tp);
+ t_name = xmkstemp(&tp, "w");
if (!t_name || !tp) {
return -1;
}
diff --git a/src/utils.c b/src/utils.c
index d8cf929..2b4d275 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -470,12 +470,12 @@ void debug_shell() {
exit(255);
}
-char *xmkstemp(FILE **fp) {
+char *xmkstemp(FILE **fp, const char *mode) {
char t_name[PATH_MAX];
sprintf(t_name, "%s/%s", globals.tmpdir, "OMC.XXXXXX");
int fd = mkstemp(t_name);
- *fp = fdopen(fd, "w");
+ *fp = fdopen(fd, mode);
if (!*fp) {
if (fd > 0)
close(fd);