Explorar el Código

Report when a file cannot be opened

pull/108/head
Zac Stewart hace 4 años
padre
commit
5402136e62
Se han modificado 1 ficheros con 5 adiciones y 0 borrados
  1. +5
    -0
      tools/blkpack.c

+ 5
- 0
tools/blkpack.c Ver fichero

@@ -2,6 +2,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <dirent.h>
#include <errno.h>
#include <string.h>
#include <sys/stat.h>

@@ -41,6 +42,10 @@ int main(int argc, char *argv[])
strcat(fullpath, "/");
strcat(fullpath, ep->d_name);
FILE *fp = fopen(fullpath, "r");
if (fp == NULL) {
fprintf(stderr, "Could not open %s: %s\n", ep->d_name, strerror(errno));
continue;
}
char *line = NULL;
size_t n = 0;
for (int i=0; i<16; i++) {


Cargando…
Cancelar
Guardar