diff --git a/webserver/doskast-trigger-connect.c b/webserver/doskast-trigger-connect.c index 80fe989..97d4c31 100644 --- a/webserver/doskast-trigger-connect.c +++ b/webserver/doskast-trigger-connect.c @@ -112,8 +112,18 @@ main(){ } } 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); - 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; fcgi_out: printf("Status: %d\n", http_code);