Why do I get Abort trap: 6?
#include <stdio.h>
#include <stdlib.h>

int check_permissions(char *file_perm, char *required_perm) {
	// first is permissions of file, second is permissions required
	for (int i = 0; i < 9; i++) {
		// if the required perm char is -, don't care about the file perm char
		if (required_perm[i] != '-' && file_perm[i] != required_perm[i]) {
			return 1;
		}
	}
	return 0;
}
	

int main(int argc, char** argv) {
    if (!(argc == 2 || argc == 3)) {
        fprintf(stderr, "USAGE: count_large size [permissions]\n");
        return 1;
    }

    int cutoff_size = strtol(argv[1], NULL, 10);
    char file_perms[11];
    int file_size;
    char file_name[32];

    // scan and ignore the first line that says total: ...
    scanf("%*s %*d");  
    int count = 0;
    while (scanf("%s %*d %*s %*s %d %*s %*s %*s %s", file_perms, 
    	&file_size, file_name) == 3) {
    	// note argv[2] points to the array of required perms
    	if (file_size > cutoff_size && 
            (argc == 2 || check_permissions(&file_perms[1], argv[2]) == 0)) {
            count++;
        }
    }
    printf("%d\n", count);
    
    return 0;
}
