<commit_before>/*
 * This file is part of libthingamabob.
 *
 * Copyright (C) 2016 Intel Corporation
 *
 * libthingamabob is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1
 * of the License, or (at your option) any later version.
 */


#define _GNU_SOURCE

#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <dirent.h>
#include <stdbool.h>
#include <sys/param.h>
#include <assert.h>

#include "util.h"

void dump_file_descriptor_leaks(void)
{
        DIR *dir = NULL;
        struct dirent *entry = NULL;

        dir = opendir("/proc/self/fd");
        if (!dir) {
                return;
        }

        while ((entry = readdir(dir)) != NULL) {
                autofree(char) *filename = NULL;
                char buffer[PATH_MAX + 1] = { 0 };
                size_t size;<commit_msg>Document origin of dump_file_descriptor_leaks<commit_after>/*
 * This file is part of libthingamabob.
 *
 * Copyright (C) 2016 Intel Corporation
 *
 * libthingamabob is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1
 * of the License, or (at your option) any later version.
 */


#define _GNU_SOURCE

#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <dirent.h>
#include <stdbool.h>
#include <sys/param.h>
#include <assert.h>

#include "util.h"

/**
 * Taken from swupd
 */
void dump_file_descriptor_leaks(void)
{
        DIR *dir = NULL;
        struct dirent *entry = NULL;

        dir = opendir("/proc/self/fd");
        if (!dir) {
                return;
        }

        while ((entry = readdir(dir)) != NULL) {
                autofree(char) *filename = NULL;
                char buffer[PATH_MAX + 1] = { 0 };
                size_t size;
{'fraction_non_alphanumeric': 0.11468812877263582, 'fraction_numerical': 0.008048289738430584, 'mean_word_length': 2.6032608695652173, 'pattern_counts': {'":': 0, '<': 19, '<?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': '2422829', 'n_tokens_mistral': 663, 'n_tokens_neox': 622, 'n_words': 205}