static struct FileInfo* get_fileinfo ( char *docroot, char *urlpath ) { struct FileInfo *info = NULL; struct stat st; dbg( "docroot=%p, urlpath=%p\n", docroot, urlpath ); memset( &st, 0x00, sizeof( st ) ); info = xmalloc( sizeof( struct FileInfo ) ); info->path = build_fspath( docroot, urlpath ); info->ok = 0; if ( lstat(info->path, &st) < 0 ) { /* not exists file */ return info; } if ( !S_ISREG( st.st_mode ) ) { /* not exists file */ return info; } /* exists file */ info->ok = 1; info->size = st.st_size; return info; }
static struct FileInfo *get_fileinfo(char *docroot, char *urlpath) { struct FileInfo *info; struct stat st; info = xmalloc(sizeof(struct FileInfo)); info->path = build_fspath(docroot, urlpath); info->ok = 0; if (lstat(info->path, &st) < 0) { return info; } if (!S_ISREG(st.st_mode)) { return info; } info->ok = 1; info->size = st.st_size; return info; }