mailing list of musl libc
 help / color / mirror / code / Atom feed
4d3476fa91ee89d6401ba001443765c810434fb9 blob 482 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
 
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <time.h>
#include <stdint.h>
#include "libc.h"

char *__randname(char *template)
{
	struct timespec ts;
	size_t i, l = strlen(template);
	unsigned long r;

	/* This assumes that a check for the template
	   size has alrady been made */
	clock_gettime(CLOCK_REALTIME, &ts);
	r = ts.tv_nsec + (uintptr_t)&ts / 16 + (uintptr_t)template;
	for (i=1; i<=6; i++, r>>=4)
		template[l-i] = 'A'+(r&15);

	return template;
}
debug log:

solving 4d3476f ...
found 4d3476f in https://inbox.vuxu.org/musl/1359349583-3643-1-git-send-email-basile@opensource.dyc.edu/

applying [1/1] https://inbox.vuxu.org/musl/1359349583-3643-1-git-send-email-basile@opensource.dyc.edu/
diff --git a/src/temp/randname.c b/src/temp/randname.c
new file mode 100644
index 0000000..4d3476f

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

index at:
100644 4d3476fa91ee89d6401ba001443765c810434fb9	src/temp/randname.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).