]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Dump gErr on regex failures
authorOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:22:56 +0000 (11:22 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:22:56 +0000 (11:22 -0700)
With pcre moving outside glib, there are new errors, such as pcre
not being built with UTF-8 support, that can be caught here.

open-vm-tools/services/plugins/vix/vixTools.c

index 54b02398a590a58406ec9d017248c25bb3247c76..56ee94ffbd91c4a65be53fb1666d1fa9077ce36a 100644 (file)
@@ -6255,7 +6255,7 @@ VixToolsListFiles(VixCommandRequestHeader *requestMsg,    // IN
    int remaining = 0;
    int numResults;
    GRegex *regex = NULL;
-   GError *gerr = NULL;
+   GError *gErr = NULL;
    char *pathName;
    VMAutomationRequestParser parser;
 
@@ -6309,10 +6309,11 @@ VixToolsListFiles(VixCommandRequestHeader *requestMsg,    // IN
            index, maxResults, (int) offset);
 
    if (pattern) {
-      regex = g_regex_new(pattern, 0, 0, &gerr);
+      regex = g_regex_new(pattern, 0, 0, &gErr);
       if (!regex) {
-         g_warning("%s: bad regex pattern '%s'; failing with INVALID_ARG\n",
-                   __FUNCTION__, pattern);
+         g_warning("%s: bad regex pattern '%s' (%s);"
+                   "failing with INVALID_ARG\n",
+                   __FUNCTION__, pattern, gErr ? gErr->message : "");
          err = VIX_E_INVALID_ARG;
          goto abort;
       }