diff options
author | Michael Larson <mike@vyatta.com> | 2010-11-09 17:28:47 -0800 |
---|---|---|
committer | Michael Larson <mike@vyatta.com> | 2010-11-09 17:28:47 -0800 |
commit | 1d3fd053d4f76633567e321528b894ed1f727b73 (patch) | |
tree | 1eae27bb6c06c4d6ba4121e6648cbb8bef8b192a /src | |
parent | 8d750fc2164ed2db0a7784a7d74ae5644526364b (diff) | |
download | vyatta-cfg-1d3fd053d4f76633567e321528b894ed1f727b73.tar.gz vyatta-cfg-1d3fd053d4f76633567e321528b894ed1f727b73.zip |
make commit aware of error location key and allow for passthrough.
Diffstat (limited to 'src')
-rw-r--r-- | src/commit2.c | 63 |
1 files changed, 34 insertions, 29 deletions
diff --git a/src/commit2.c b/src/commit2.c index 2f9be94..92f37ed 100644 --- a/src/commit2.c +++ b/src/commit2.c @@ -564,36 +564,41 @@ process_func(GNode *node, gpointer data) status = execute_list(c->_def.actions[result->_action].vtw_list_head,&c->_def,NULL); } if (!status && g_print_error_location_all == TRUE) { //EXECUTE_LIST RETURNS FALSE ON FAILURE.... - //just need to convert slashes into spaces here - char path_buf[1024]; - char tmp[1024]; - char *ptr; - path_buf[0] = '\0'; - - strcpy(tmp,d->_path); - ptr = (char*)tmp; - char *slash = strchr(tmp,'/'); - if (slash == NULL) { - strcat(path_buf,d->_path); + if (strstr(outbuf,"_errloc_:[") != NULL) { + fprintf(out_stream,"%s\n",outbuf); } else { - do { //convert '/' to ' ' - strncat(path_buf,ptr,slash - ptr); - strcat(path_buf," "); - ++slash; - ptr = slash; - } while ((slash = strchr(slash,'/')) != NULL); - } - if (strncmp(ptr,"value:",6) == 0) { - if (strlen(ptr)-6 > 0) { - strncat(path_buf,ptr+6,strlen(ptr)-6); + //just need to convert slashes into spaces here + char path_buf[1024]; + char tmp[1024]; + char *ptr; + path_buf[0] = '\0'; + + strcpy(tmp,d->_path); + ptr = (char*)tmp; + char *slash = strchr(tmp,'/'); + if (slash == NULL) { + strcat(path_buf,d->_path); + } + else { + do { //convert '/' to ' ' + strncat(path_buf,ptr,slash - ptr); + strcat(path_buf," "); + ++slash; + ptr = slash; + } while ((slash = strchr(slash,'/')) != NULL); + } + if (strncmp(ptr,"value:",6) == 0) { + if (strlen(ptr)-6 > 0) { + strncat(path_buf,ptr+6,strlen(ptr)-6); + } + } + char *p = clind_unescape(path_buf); + + if (strlen(outbuf) > 0) { + //currently set to format option for GUI client. + fprintf(out_stream,"_errloc_:[%s]\n%s\n",p,outbuf); } - } - char *p = clind_unescape(path_buf); - - if (strlen(outbuf) > 0) { - //currently set to format option for GUI client. - fprintf(out_stream,"_errloc_:[%s]\n%s\n",p,outbuf); } } } @@ -624,7 +629,7 @@ process_func(GNode *node, gpointer data) if (!status) { //EXECUTE_LIST RETURNS FALSE ON FAILURE.... syslog(LOG_ERR,"commit error for %s:[%s]\n",ActionNames[result->_action],d->_path); if (g_display_error_node) { - fprintf(out_stream,"%s@errloc:[%s]\n",ActionNames[result->_action],d->_path); + fprintf(out_stream,"%s@_errloc_:[%s]\n",ActionNames[result->_action],d->_path); } result->_err_code = 1; if (g_debug) { @@ -1473,7 +1478,7 @@ validate_func(GNode *node, gpointer data) } syslog(LOG_ERR,"commit error for %s:[%s]\n",ActionNames[result->_action],d->_path); if (g_display_error_node) { - fprintf(out_stream,"%s@errloc:[%s]\n",ActionNames[result->_action],d->_path); + fprintf(out_stream,"%s@_errloc_:[%s]\n",ActionNames[result->_action],d->_path); } result->_err_code = 1; if (g_debug) { |