Closed GoogleCodeExporter closed 9 years ago
The following is enough code to detect the error on Linux and RTEMS and return
an
error. It may have to be different on Windows.
static bool_t
set_root_option(struct mg_context *ctx, const char *root)
{
struct stat buf;
if ( stat(root, &buf) != 0) {
cry(fc(ctx), "Invalid directory for root (%s)", root);
return (FALSE);
}
return (TRUE);
}
static const struct mg_option known_options[] = {
{"root", "\tWeb root directory", NULL, OPT_ROOT, set_root_option},
Original comment by joel.she...@gmail.com
on 16 Nov 2009 at 5:22
Doh! You guys already had mg_stat. :)
static bool_t
set_root_option(struct mg_context *ctx, const char *root)
{
struct mgstat buf;
if ( mg_stat(root, &buf) != 0) {
cry(fc(ctx), "Invalid directory for root (%s)", root);
return (FALSE);
}
return (TRUE);
}
Original comment by joel.she...@gmail.com
on 16 Nov 2009 at 5:26
Patched in, http://code.google.com/p/mongoose/source/detail?r=478
Thank you!
Original comment by valenok
on 27 Nov 2009 at 5:15
Original issue reported on code.google.com by
joel.she...@gmail.com
on 16 Nov 2009 at 2:56