<commit_before>/* vi: set sw=4 ts=4: */
/* testcase for futimens(2)
 * Copyright (C) 2009 <NAME> <<EMAIL>>
 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 */
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <stdlib.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>

struct
{
	char *name; /* name of file to open */
	int flags; /* flags for file descriptor */
	const struct timespec ts[2];
	int err; /* expected errno */
} tests [] =
{
	{"futimens.tst", (O_CREAT|O_TRUNC), {{0,0},{0,0}}, 0},
	{"futimens.tst", (O_CREAT|O_TRUNC), {{99,0},{0,0}}, 0},
	{"futimens.tst", (O_CREAT|O_TRUNC), {{0,99},{0,0}}, 0},
	{"futimens.tst", (O_CREAT|O_TRUNC), {{0,0},{99,0}}, 0},
	{"futimens.tst", (O_CREAT|O_TRUNC), {{0,0},{0,99}}, 0},
	{"futimens.tst", (O_CREAT|O_TRUNC), {{11,2},{3,4}}, 0},
};
int do_test(int argc, char **argv) {
	char *name;
	int i, errors;
	errors = argc - argc + 0;
	unsigned has_stat_nsec = 0;
	{
		struct stat probe;
		/* Let's attempt an educated guess if this filesystem supports
		 * nanosecond mtime.  */
		if ((!stat(".", &probe)) && probe.st_mtim.tv_nsec)
			has_stat_nsec = 1;
		else if ((!stat(argv[0], &probe)) && probe.st_mtim.tv_nsec)
			has_stat_nsec = 1;
	}
	for (i=0; i < (int) (sizeof(tests)/sizeof(tests[0])); ++i) {
		int err, fd;
		struct stat sb;
		name = tests[i].name;
		if (*name != '.')
			unlink(name);
		fd = open(name, tests[i].flags);
		if (fd < 0)
			abort();<commit_msg>tests: tst-futimens1: add missing mode args to open()<commit_after>/* vi: set sw=4 ts=4: */
/* testcase for futimens(2)
 * Copyright (C) 2009 <NAME> <<EMAIL>>
 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 */
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <stdlib.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>

struct
{
	char *name; /* name of file to open */
	int flags; /* flags for file descriptor */
	const struct timespec ts[2];
	int err; /* expected errno */
} tests [] =
{
	{"futimens.tst", (O_CREAT|O_TRUNC), {{0,0},{0,0}}, 0},
	{"futimens.tst", (O_CREAT|O_TRUNC), {{99,0},{0,0}}, 0},
	{"futimens.tst", (O_CREAT|O_TRUNC), {{0,99},{0,0}}, 0},
	{"futimens.tst", (O_CREAT|O_TRUNC), {{0,0},{99,0}}, 0},
	{"futimens.tst", (O_CREAT|O_TRUNC), {{0,0},{0,99}}, 0},
	{"futimens.tst", (O_CREAT|O_TRUNC), {{11,2},{3,4}}, 0},
};
int do_test(int argc, char **argv) {
	char *name;
	int i, errors;
	errors = argc - argc + 0;
	unsigned has_stat_nsec = 0;
	{
		struct stat probe;
		/* Let's attempt an educated guess if this filesystem supports
		 * nanosecond mtime.  */
		if ((!stat(".", &probe)) && probe.st_mtim.tv_nsec)
			has_stat_nsec = 1;
		else if ((!stat(argv[0], &probe)) && probe.st_mtim.tv_nsec)
			has_stat_nsec = 1;
	}
	for (i=0; i < (int) (sizeof(tests)/sizeof(tests[0])); ++i) {
		int err, fd;
		struct stat sb;
		name = tests[i].name;
		if (*name != '.')
			unlink(name);
		fd = open(name, tests[i].flags, 0660);
		if (fd < 0)
			abort();
{'fraction_non_alphanumeric': 0.2217012726054923, 'fraction_numerical': 0.03717347622237106, 'mean_word_length': 4.079931972789115, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 23, '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': '6242853', 'n_tokens_mistral': 1406, 'n_tokens_neox': 1302, 'n_words': 315}