mirror of
https://github.com/emikulic/darkhttpd.git
synced 2023-08-10 21:13:08 +03:00
. strip_endslash() should not have been reallocating argv[1]
. Remove strip_endslash() by boiling it down to one line and putting that line where the function call used to be.
This commit is contained in:
parent
f7c0995234
commit
255a78d0c4
@ -826,21 +826,6 @@ static void usage(void)
|
||||
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Strips the ending slash from a string (if there is one) and re-allocates
|
||||
* the string.
|
||||
*/
|
||||
static void strip_endslash(char **str)
|
||||
{
|
||||
if (strlen(*str) < 1) return;
|
||||
if ((*str)[strlen(*str)-1] != '/') return;
|
||||
|
||||
(*str)[strlen(*str)-1] = 0;
|
||||
*str = xrealloc(*str, strlen(*str)+1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Parses commandline options.
|
||||
*/
|
||||
@ -854,9 +839,9 @@ static void parse_commandline(const int argc, char *argv[])
|
||||
)
|
||||
usage(); /* no wwwroot given */
|
||||
|
||||
/*wwwroot = xstrdup(argv[1]); FIXME */
|
||||
wwwroot = argv[1];
|
||||
strip_endslash(&wwwroot);
|
||||
/* Strip ending slash. */
|
||||
if (wwwroot[strlen(wwwroot)-1] == '/') wwwroot[strlen(wwwroot)-1] = '\0';
|
||||
|
||||
/* walk through the remainder of the arguments (if any) */
|
||||
for (i=2; i<argc; i++)
|
||||
@ -1844,7 +1829,6 @@ static void exit_quickly(int sig)
|
||||
}
|
||||
free(mime_map);
|
||||
free(keep_alive_field);
|
||||
/*free(wwwroot); FIXME */
|
||||
printf("done!\n");
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user