<commit_before>#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <utempter.h>
#include <wait.h>

int
main(int argc, char **argv)
{
  pid_t child;

  if(utempter_add_record(STDIN_FILENO, (char *) NULL) != 0)
    return EXIT_FAILURE;

  if((child = fork())) {
    if(child < 0)
      return EXIT_FAILURE;
    if(waitpid(child, (int *) NULL, 0) != child)
      return EXIT_FAILURE;
    if(utempter_remove_record(STDIN_FILENO) != 0)
      return EXIT_FAILURE;
    return EXIT_SUCCESS;
  }

  execv(argv[1], argv + 2);
  /*NOTREACHED*/
}
<commit_msg>Better error reporting.<commit_after>#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <utempter.h>
#include <wait.h>

int
main(int argc, char **argv)
{
  pid_t child;

  if(utempter_add_record(STDIN_FILENO, (char *) NULL) == 0) {
    perror("Couldn't add record to utmp");
    return EXIT_FAILURE;
  }

  if((child = fork()) == 0) {
    execv(argv[1], argv + 2);
    /*NOTREACHED*/
  }

  if(child < 0) {
    perror("fork failed");
    return EXIT_FAILURE;
  }

  if(waitpid(child, (int *) NULL, 0) != child) {
    perror("waitpid failed");
    return EXIT_FAILURE;
  }

  if(utempter_remove_record(STDIN_FILENO) == 0) {
    perror("Couldn't remove record from utmp");
    return EXIT_FAILURE;
  }

  return EXIT_SUCCESS;
}

{'fraction_non_alphanumeric': 0.15828957239309827, 'fraction_numerical': 0.009752438109527382, 'mean_word_length': 3.6319444444444446, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 14, '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': '4755360', 'n_tokens_mistral': 556, 'n_tokens_neox': 532, 'n_words': 111}