diff options
author | Lev Walkin <vlm@lionet.info> | 2016-01-23 08:04:46 -0800 |
---|---|---|
committer | Lev Walkin <vlm@lionet.info> | 2016-01-23 08:04:46 -0800 |
commit | d62d7d51b06f17550e971e8aef16cb115875669a (patch) | |
tree | 3c7f6fdf774685b04f6bc56e12d8407cb28438c8 /libasn1compiler | |
parent | 47d884c7828140a4ca793631e0a2855f64ff93be (diff) |
ftruncate output should not be ignored under some compilers
Diffstat (limited to 'libasn1compiler')
-rw-r--r-- | libasn1compiler/asn1c_compat.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libasn1compiler/asn1c_compat.c b/libasn1compiler/asn1c_compat.c index be0f1212..4bd70f31 100644 --- a/libasn1compiler/asn1c_compat.c +++ b/libasn1compiler/asn1c_compat.c @@ -95,7 +95,12 @@ asn1c_open_file(const char *name, const char *ext, char **opt_tmpname) { return NULL; } - (void)ftruncate(fd, 0); + if(ftruncate(fd, 0) == -1) { + fprintf(stderr, "%s: ftruncate failed: %s\n", + fname, strerror(errno)); + if(created) unlink(fname); + return NULL; + } #else _chsize(fd, 0); #endif /* _WIN32 */ |