is this right

if ((r = fork()) > 0) {          // If parent process
    if ((close(fd[0])) == -1) {  // Close the read
        perror("close");
    }

    if (write(fd[1], user_id, MAXLINE) == -1) {  // Write the user id
        perror("write to pipe");
    }

    if (write(fd[1], password, MAXLINE) == -1) {  // Write the password
        perror("write to pipe");
    }

    if ((close(fd[1])) == -1) {  // Close the write
        perror("close");
    }

    int status;
    wait(&status);  // wait

    if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {  // If it is equal to 0
        printf(SUCCESS);
    } else if (WIFEXITED(status)) {
        printf(INVALID);
    }
