check i/o errors

master
Mikhail Novosyolov 3 years ago
parent fcd29a4974
commit 6ac8f630da
  1. 12
      webserver/doskast-trigger-connect.c

@ -112,8 +112,18 @@ main(){
} }
} }
FCGI_FILE *d = fopen(hex, "w"); FCGI_FILE *d = fopen(hex, "w");
if (d == NULL) {
fprintf(stderr, "Error openning file %s/%s for writing\n", DIR, hex);
http_code = HTTP_ERROR;
goto fcgi_out;
}
fprintf(d, "%s", ip); fprintf(d, "%s", ip);
fclose(d); rc = fclose(d);
if (rc != 0) {
fprintf(stderr, "Error closing file %s/%s\n", DIR, hex);
http_code = HTTP_ERROR;
goto fcgi_out;
}
http_code = HTTP_OK; http_code = HTTP_OK;
fcgi_out: fcgi_out:
printf("Status: %d\n", http_code); printf("Status: %d\n", http_code);

Loading…
Cancel
Save