diff options
| author | Matthias Schiffer | 2020-05-16 11:33:55 +0000 |
|---|---|---|
| committer | Matthias Schiffer | 2020-05-16 12:14:02 +0000 |
| commit | afc86f352bf7915f81e9d38949e91306542aadee (patch) | |
| tree | 2086fefc1b3d92c9468ecb75af430c0e1e42f14e | |
| parent | fdff10852326122134a60911a3b3c7c2aeab5723 (diff) | |
| download | ucert-afc86f352bf7915f81e9d38949e91306542aadee.tar.gz | |
Fix return code of write_file()
write_file() returns 1/true on success; it should return 0/false when
opening the file fails.
To make it more obvious that is function returns true and not 0 on
success, also change its return type to bool.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
| -rw-r--r-- | ucert.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -116,13 +116,13 @@ struct cert_object { }; /* write buffer to file */ -static int write_file(const char *filename, void *buf, size_t len, bool append) { +static bool write_file(const char *filename, void *buf, size_t len, bool append) { FILE *f; size_t outlen; f = fopen(filename, append?"a":"w"); if (!f) - return 1; + return false; outlen = fwrite(buf, 1, len, f); fclose(f); |