diff options
| author | jvoisin | 2017-09-21 16:19:44 +0200 |
|---|---|---|
| committer | jvoisin | 2017-09-22 17:45:32 +0200 |
| commit | 3ba2b7e37cb24f951f557c4a4f62920154a7c0d2 (patch) | |
| tree | c904d0acf0e7eddb0a3697baff59cc237a7d6250 /src/sp_utils.c | |
| parent | 6487590b4fd55dddd59b43f1fcf2ebd8d56f20ac (diff) | |
Improve a bit the .travis.yml file
Diffstat (limited to 'src/sp_utils.c')
| -rw-r--r-- | src/sp_utils.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/sp_utils.c b/src/sp_utils.c index 56512df..2370a6d 100644 --- a/src/sp_utils.c +++ b/src/sp_utils.c | |||
| @@ -39,7 +39,7 @@ int compute_hash(const char* const filename, char* file_hash) { | |||
| 39 | php_stream_open_wrapper(filename, "rb", REPORT_ERRORS, NULL); | 39 | php_stream_open_wrapper(filename, "rb", REPORT_ERRORS, NULL); |
| 40 | if (!stream) { | 40 | if (!stream) { |
| 41 | sp_log_err("hash_computation", "Can not open the file %s to compute its hash.\n", filename); | 41 | sp_log_err("hash_computation", "Can not open the file %s to compute its hash.\n", filename); |
| 42 | return -1; | 42 | return FAILURE; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | PHP_SHA256Init(&context); | 45 | PHP_SHA256Init(&context); |
| @@ -49,7 +49,7 @@ int compute_hash(const char* const filename, char* file_hash) { | |||
| 49 | PHP_SHA256Final(digest, &context); | 49 | PHP_SHA256Final(digest, &context); |
| 50 | php_stream_close(stream); | 50 | php_stream_close(stream); |
| 51 | make_digest_ex(file_hash, digest, SHA256_SIZE); | 51 | make_digest_ex(file_hash, digest, SHA256_SIZE); |
| 52 | return 0; | 52 | return SUCCESS; |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | static void construct_filename(char* filename, const char* folder) { | 55 | static void construct_filename(char* filename, const char* folder) { |
| @@ -123,7 +123,7 @@ int sp_log_request(const char* folder) { | |||
| 123 | 123 | ||
| 124 | // Allocate and copy the data | 124 | // Allocate and copy the data |
| 125 | // FIXME Why are we even allocating? | 125 | // FIXME Why are we even allocating? |
| 126 | param = pecalloc(params_len, 1, 0); | 126 | param = ecalloc(params_len, 1); |
| 127 | NCAT_AND_DEC(param, zones[i].str, params_len); | 127 | NCAT_AND_DEC(param, zones[i].str, params_len); |
| 128 | NCAT_AND_DEC(param, ":", params_len); | 128 | NCAT_AND_DEC(param, ":", params_len); |
| 129 | ZEND_HASH_FOREACH_STR_KEY_VAL(ht, variable_key, variable_value) { | 129 | ZEND_HASH_FOREACH_STR_KEY_VAL(ht, variable_key, variable_value) { |
| @@ -138,6 +138,7 @@ int sp_log_request(const char* folder) { | |||
| 138 | 138 | ||
| 139 | fputs(param, file); | 139 | fputs(param, file); |
| 140 | fputs("\n", file); | 140 | fputs("\n", file); |
| 141 | efree(param); | ||
| 141 | } | 142 | } |
| 142 | fclose(file); | 143 | fclose(file); |
| 143 | 144 | ||
