[PATCH] xkbcomp: Remove output file if closing fails.
Rami Ylimaki
ext-rami.ylimaki at nokia.com
Wed Aug 5 07:16:16 PDT 2009
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 at nokia.com>
---
xkbcomp.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/xkbcomp.c b/xkbcomp.c
index 988b5c5..bf3f670 100644
--- a/xkbcomp.c
+++ b/xkbcomp.c
@@ -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);
}
--
1.6.0.4
More information about the xorg-devel
mailing list