From 12fe8cc4a28dee4626cea24b7b375a65ea174782 Mon Sep 17 00:00:00 2001 From: Michael Ow Date: Thu, 14 Jul 2011 18:51:40 +0000 Subject: [PATCH] ICU-8693 Display error message when missing needed options and given bad file names in pkgdata tool X-SVN-Rev: 30346 --- icu4c/source/tools/pkgdata/pkgdata.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/icu4c/source/tools/pkgdata/pkgdata.cpp b/icu4c/source/tools/pkgdata/pkgdata.cpp index 6eae24792b..a7393572cd 100644 --- a/icu4c/source/tools/pkgdata/pkgdata.cpp +++ b/icu4c/source/tools/pkgdata/pkgdata.cpp @@ -617,6 +617,7 @@ static int32_t pkg_executeOptions(UPKGOptions *o) { } if (result != 0) { fprintf(stderr, "Unable to move dat file (%s) to target location (%s).\n", datFileNamePath, targetFileNamePath); + return result; } if (o->install != NULL) { @@ -624,7 +625,7 @@ static int32_t pkg_executeOptions(UPKGOptions *o) { } return result; - } else /* if (mode[0] == MODE_STATIC || mode[0] == MODE_DLL) */ { + } else /* if (mode == MODE_STATIC || mode == MODE_DLL) */ { char gencFilePath[SMALL_BUFFER_MAX_SIZE] = ""; char version_major[10] = ""; UBool reverseExt = FALSE; @@ -639,6 +640,11 @@ static int32_t pkg_executeOptions(UPKGOptions *o) { } version_major[i] = o->version[i]; } + } else { + if (mode == MODE_DLL) { + fprintf(stderr, "Please provide a revision number with the -r option\n"); + return -1; + } } #ifndef OS400 @@ -1825,7 +1831,7 @@ static void loadLists(UPKGOptions *o, UErrorCode *status) /* normal mode.. o->files is just the bare list without package names */ o->files = pkg_appendToList(o->files, &tail, uprv_strdup(linePtr)); - if(uprv_pathIsAbsolute(s)) { + if(uprv_pathIsAbsolute(s) || s[0] == '.') { fprintf(stderr, "pkgdata: Error: absolute path encountered. Old style paths are not supported. Use relative paths such as 'fur.res' or 'translit%cfur.res'.\n\tBad path: '%s'\n", U_FILE_SEP_CHAR, s); exit(U_ILLEGAL_ARGUMENT_ERROR); }