summaryrefslogtreecommitdiff
path: root/i18npool/source/indexentry
diff options
context:
space:
mode:
authorTor Lillqvist <tlillqvist@novell.com>2011-08-19 17:50:40 +0300
committerTor Lillqvist <tlillqvist@novell.com>2011-08-19 17:59:03 +0300
commita72c7acad90f9431c3b800327734ea00458dc3a0 (patch)
treea3794808ac2ba2250cb3f5759c6665f0e3e5de0f /i18npool/source/indexentry
parentbb58d59e6479b8f2548574a561c64a17601b15a1 (diff)
Improve input and output file open error handling
Tell file name and actual error in error message. Print error message to stderr. Always exit with failure when not able to open an input or output file.
Diffstat (limited to 'i18npool/source/indexentry')
-rw-r--r--i18npool/source/indexentry/genindex_data.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/i18npool/source/indexentry/genindex_data.cxx b/i18npool/source/indexentry/genindex_data.cxx
index 48ae02576a87..85424536a29d 100644
--- a/i18npool/source/indexentry/genindex_data.cxx
+++ b/i18npool/source/indexentry/genindex_data.cxx
@@ -51,8 +51,8 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
fp = fopen(argv[1], "rb"); // open the source file for read;
if (fp == NULL) {
- printf("Open the rule source file failed.");
- return 1;
+ fprintf(stderr, "Opening the rule source file %s for reading failed: %s\n", argv[1], strerror(errno));
+ exit(1);
}
@@ -97,8 +97,8 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
fp = fopen(argv[2], "wb");
if (fp == NULL) {
- printf("Can't create the C source file.");
- return 1;
+ fprintf(stderr, "Opening %s for writing failed: %s\n", argv[2], strerror(errno));
+ exit(1);
}
fprintf(fp, "/*\n");