diff options
author | Rami Ylimaki <ext-rami.ylimaki@nokia.com> | 2009-08-05 17:16:16 +0300 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-08-06 11:49:48 +1000 |
commit | a36ca5ba61e2b97398a79713922644fee1a263d1 (patch) | |
tree | 5cad3f7a91d1025b63326092c8ffb808bc22083c | |
parent | 2cc1dc9a327a5100043d3d54e899b98b81cdf5f5 (diff) |
xkbcomp: Remove output file if closing fails.
Without the fix xkbcomp may leave a truncated file in the filesystem
if there is not enough disk space. Using the truncated file leads to
problems.
Signed-off-by: Rami Ylimaki <ext-rami.ylimaki@nokia.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | xkbcomp.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -1192,11 +1192,19 @@ main(int argc, char *argv[]) } if (outputFormat != WANT_X_SERVER) { - fclose(out); - if (!ok) + if (fclose(out)) + { + ERROR1("Cannot close \"%s\" properly (not enough space?)\n", + outputFile); + ok= False; + } + else if (!ok) { ERROR2("%s in %s\n", _XkbErrMessages[_XkbErrCode], _XkbErrLocation ? _XkbErrLocation : "unknown"); + } + if (!ok) + { ACTION1("Output file \"%s\" removed\n", outputFile); unlink(outputFile); } |