<commit_before>#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <time.h>
#include <stdint.h>
#include "libc.h"

char *__mktemp(char *template)
{
	struct timespec ts;
	size_t l = strlen(template);
	int retries = 10000;
	unsigned long r;

	if (l < 6 || strcmp(template+l-6, "XXXXXX")) {
		errno = EINVAL;
		return 0;
	}
	clock_gettime(CLOCK_REALTIME, &ts);
	r = ts.tv_nsec + (uintptr_t)&ts / 16 + (uintptr_t)template;
	while (retries--) {
		snprintf(template+l-6, 7, "%06lX", r & 0xffffff);
		if (access(template, F_OK) < 0) return template;
		r = r * 1103515245 + 12345;
	}
	*template = 0;
	errno = EEXIST;
	return template;
}

weak_alias(__mktemp, mktemp);<commit_msg>another return value fix for mktemp...<commit_after>#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <time.h>
#include <stdint.h>
#include "libc.h"

char *__mktemp(char *template)
{
	struct timespec ts;
	size_t l = strlen(template);
	int retries = 10000;
	unsigned long r;

	if (l < 6 || strcmp(template+l-6, "XXXXXX")) {
		errno = EINVAL;
		*template = 0;
		return template;
	}
	clock_gettime(CLOCK_REALTIME, &ts);
	r = ts.tv_nsec + (uintptr_t)&ts / 16 + (uintptr_t)template;
	while (retries--) {
		snprintf(template+l-6, 7, "%06lX", r & 0xffffff);
		if (access(template, F_OK) < 0) return template;
		r = r * 1103515245 + 12345;
	}
	*template = 0;
	errno = EEXIST;
	return template;
}

weak_alias(__mktemp, mktemp);
{'fraction_non_alphanumeric': 0.1663417803768681, 'fraction_numerical': 0.04158544509421702, 'mean_word_length': 4.384615384615385, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7012506', 'n_tokens_mistral': 720, 'n_tokens_neox': 642, 'n_words': 154}