mailing list of musl libc
 help / color / mirror / code / Atom feed
d389ec8cde7ae3fd279a72ea728053209f4b90c4 blob 583 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include "libc.h"

void __randname(char *);

int __mkostemps (char *template, int suffixlen, int flags)
{
	size_t l = strlen(template);
	char *x6 = template + l - suffixlen;
	if(l - suffixlen < 6 || memcmp(x6, "XXXXXX", 6)) {
		errno = EINVAL;
		*template = 0;
		return -1;
	}

	int fd, retries = 100;
	while (retries--) {
		__randname(x6);
		if ((fd = open(template, flags | O_CREAT | O_EXCL, 0600))>=0)
			return fd;
		if (errno != EEXIST) return -1;
	}
	return -1;
}

weak_alias(__mkostemps, mkostemps);
LFS64(mkostemps);
debug log:

solving d389ec8 ...
found d389ec8 in https://inbox.vuxu.org/musl/510D6E30.60206@barfooze.de/

applying [1/1] https://inbox.vuxu.org/musl/510D6E30.60206@barfooze.de/
diff --git a/src/temp/mkostemps.c b/src/temp/mkostemps.c
new file mode 100644
index 0000000..d389ec8

Checking patch src/temp/mkostemps.c...
Applied patch src/temp/mkostemps.c cleanly.

index at:
100644 d389ec8cde7ae3fd279a72ea728053209f4b90c4	src/temp/mkostemps.c

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).