aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2009-03-08 22:42:50 +0000
committerDaniel Stenberg <daniel@haxx.se>2009-03-08 22:42:50 +0000
commit9274d3169089f86f7ba1b3553585cfe6a2747f2e (patch)
treee33b3309e9017a3a95560cc2691c369de46b83cd /src/main.c
parent983a53950399a8a9b60b97b99884935aba2c4c9e (diff)
- Bill Egert pointed out (http://curl.haxx.se/bug/view.cgi?id=2671602) that
curl didn't use sprintf() in a way that is documented to work in POSIX but since we use our own printf() code (from libcurl) that shouldn't be a problem. Nonetheless I modified the code to not rely on such particular features and to not cause further raised eyebrowse with no good reason.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 958c8b514..aabd659fe 100644
--- a/src/main.c
+++ b/src/main.c
@@ -5286,13 +5286,14 @@ static int create_dir_hierarchy(const char *outfile, FILE *errors)
/* since strtok returns a token for the last word even
if not ending with DIR_CHAR, we need to prune it */
if (tempdir2 != NULL) {
- if (strlen(dirbuildup) > 0)
- sprintf(dirbuildup,"%s%s%s",dirbuildup, DIR_CHAR, tempdir);
+ size_t dlen = strlen(dirbuildup);
+ if (dlen)
+ sprintf(&dirbuildup[dlen], "%s%s", DIR_CHAR, tempdir);
else {
if (0 != strncmp(outdup, DIR_CHAR, 1))
- sprintf(dirbuildup,"%s",tempdir);
+ strcpy(dirbuildup, tempdir);
else
- sprintf(dirbuildup,"%s%s", DIR_CHAR, tempdir);
+ sprintf(dirbuildup, "%s%s", DIR_CHAR, tempdir);
}
if (access(dirbuildup, F_OK) == -1) {
result = mkdir(dirbuildup,(mode_t)0000750);