strlcpy(buffer, h, sizeof buffer);
/* Is the USER:PASS@ prefix present? */
- if ((cp = strchr(buffer, '@')) != NULL) {
+ if ((cp = strrchr(buffer, '@')) != NULL) {
*cp++ = '\0';
/* The remainder is the HOST:PORT part. */
h = cp;
int ret;
for (i = 0; sp[i] >= 0; i++)
close(sp[i]);
+ /* Re-open log file in child before possibly giving
+ * up privileges (see log_close() above). */
+ log_open();
ret = fn(fd, fd);
close_all();
_exit(ret);