<commit_before>#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <sys/stat.h>
#include <dirent.h>

static int __check_dir_for_tty_match(char * dirname, struct stat *st, char *buf, size_t buflen)
{
    DIR *fp;
    int len;
    struct stat dst;
    struct dirent *d;

    fp = opendir(dirname);
    if (fp == NULL)
	return errno;
    strncpy(buf, dirname, buflen);
    strncat(buf, "/", buflen);
    len = strlen(dirname) + 1;

    while ((d = readdir(fp)) != 0) {
	strncpy(buf+len, d->d_name, buflen);
	buf[buflen]='\0';
#if 0
	/* Stupid filesystems like cramfs fail to guarantee that
	 * st_ino and st_dev uniquely identify a file, contrary to
	 * SuSv3, so we cannot be quite so precise as to require an
	 * exact match.  Settle for something less...  Grumble... */
	if (stat(buf, &dst) == 0 &&
		st->st_dev == dst.st_dev && st->st_ino == dst.st_ino)
#else
	if (stat(buf, &dst) == 0 &&<commit_msg>A patch from <NAME> so that we do not setting on symlinks when looking for a device match, and instead keep looking till we find the correct device.<commit_after>#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <sys/stat.h>
#include <dirent.h>

static int __check_dir_for_tty_match(char * dirname, struct stat *st, char *buf, size_t buflen)
{
    DIR *fp;
    int len;
    struct stat dst;
    struct dirent *d;

    fp = opendir(dirname);
    if (fp == NULL)
	return errno;
    strncpy(buf, dirname, buflen);
    strncat(buf, "/", buflen);
    len = strlen(dirname) + 1;

    while ((d = readdir(fp)) != 0) {
	strncpy(buf+len, d->d_name, buflen);
	buf[buflen]='\0';
#if 0
	/* Stupid filesystems like cramfs fail to guarantee that
	 * st_ino and st_dev uniquely identify a file, contrary to
	 * SuSv3, so we cannot be quite so precise as to require an
	 * exact match.  Settle for something less...  Grumble... */
	if (lstat(buf, &dst) == 0 &&
		st->st_dev == dst.st_dev && st->st_ino == dst.st_ino)
#else
	if (lstat(buf, &dst) == 0 &&
{'fraction_non_alphanumeric': 0.14408929477422627, 'fraction_numerical': 0.007102993404363267, 'mean_word_length': 3.4514672686230248, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 20, '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': '6850057', 'n_tokens_mistral': 770, 'n_tokens_neox': 738, 'n_words': 239}