[config] warn if server.upload-dirs has non-existent dirs (fixes #2508)

Warn at startup if any dirs in server.upload-dirs do not exist.
Take server.chroot into account, if set.

From: Glenn Strauss <gstrauss@gluelogic.com>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3125 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/heads/lighttpd-1.4.x
Glenn Strauss 7 years ago committed by Stefan Bühler
parent a579e7ffc0
commit b4a4afdaf7
  1. 1
      NEWS
  2. 25
      src/configfile.c

@ -49,6 +49,7 @@ NEWS
* [buffer] refactor buffer_path_simplify (fixes #2560)
* validate return values from strtol, strtoul (fixes #2564)
* [mod_ssi] Add SSI vars SCRIPT_{URI,URL} and REQUEST_SCHEME (fixes #2721)
* [config] warn if server.upload-dirs has non-existent dirs (fixes #2508)
- 1.4.39 - 2016-01-02
* [core] fix memset_s call (fixes #2698)

@ -1288,6 +1288,31 @@ int config_set_defaults(server *srv) {
}
}
if (srv->srvconf.upload_tempdirs->used) {
buffer * const b = srv->tmp_buf;
size_t len;
if (!buffer_string_is_empty(srv->srvconf.changeroot)) {
buffer_copy_buffer(b, srv->srvconf.changeroot);
buffer_append_slash(b);
} else {
buffer_reset(b);
}
len = buffer_string_length(b);
for (i = 0; i < srv->srvconf.upload_tempdirs->used; ++i) {
const data_string * const ds = (data_string *)srv->srvconf.upload_tempdirs->data[i];
buffer_string_set_length(b, len); /*(truncate)*/
buffer_append_string_buffer(b, ds->value);
if (-1 == stat(b->ptr, &st1)) {
log_error_write(srv, __FILE__, __LINE__, "sb",
"server.upload-dirs doesn't exist:", b);
} else if (!S_ISDIR(st1.st_mode)) {
log_error_write(srv, __FILE__, __LINE__, "sb",
"server.upload-dirs isn't a directory:", b);
}
}
}
if (buffer_string_is_empty(s->document_root)) {
log_error_write(srv, __FILE__, __LINE__, "s",
"a default document-root has to be set");

Loading…
Cancel
Save