aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGisle Vanem <gvanem@broadpark.no>2007-01-26 15:15:27 +0000
committerGisle Vanem <gvanem@broadpark.no>2007-01-26 15:15:27 +0000
commitd681bc7520b73933cab2d1176e69693770505e81 (patch)
tree88ceebc1e58ba8e01a2425f08e42ec83a2aed378
parentf21a2b32703659cb487c18e78124686b8ceaa0c4 (diff)
Options of type CURLOPTTYPE_FUNCTIONPOINT are never printable.
-rw-r--r--src/main.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index ab5bbc595..4867d1a0e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -3225,13 +3225,21 @@ CURLcode _my_setopt(CURL *curl, const char *name, CURLoption tag, ...)
}
else if(tag < CURLOPTTYPE_OFF_T) {
- /* we treat both object and function pointers like this */
void *pval = va_arg(arg, void *);
unsigned char *ptr = (unsigned char *)pval;
+ /* function pointers are never printable */
+ if (tag >= CURLOPTTYPE_FUNCTIONPOINT) {
+ if (pval) {
+ snprintf(value, sizeof(value), "%p", pval);
+ remark = TRUE;
+ }
+ else
+ strcpy(value, "NULL");
+ }
/* attempt to figure out if it is a string (since the tag numerical doesn't
offer this info) and then output it as a string if so */
- if(pval && isgraph(ptr[0]) && isgraph(ptr[1]))
+ else if(pval && isgraph(ptr[0]) && isgraph(ptr[1]))
snprintf(value, sizeof(value), "\"%s\"", (char *)ptr);
else if(pval) {
snprintf(value, sizeof(value), "%p", pval);