would this code properly read 2 things that were written to it
}
else if (r == 0) {                             // If child process
    if ((dup2(fd[0], fileno(stdin))) == -1) {  // So it can read from pipe
        perror("dup2");
        exit(1);
    }

    if ((close(fd[1])) == -1) {
        perror("close");
    }

    if ((close(fd[0])) == -1) {
        perror("close");
    }

    execl("./validate", "validate", NULL);  // Validate
}
else {
    perror("fork");  // Check for failed fork
    exit(1);
}
}