staticngx_fd_tngx_open_file_wrapper(ngx_str_t*name,ngx_open_file_info_t*of,ngx_int_tmode,ngx_int_tcreate,ngx_int_taccess,ngx_log_t*log){ngx_fd_tfd;#if!(NGX_HAVE_OPENAT)fd=ngx_open_file(name->data,mode,create,access);if(fd==NGX_INVALID_FILE){of->err=ngx_errno;of->failed=ngx_open_file_n;returnNGX_INVALID_FILE;}returnfd;#elseu_char*p,*cp,*end;ngx_fd_tat_fd;ngx_str_tat_name;if(of->disable_symlinks==NGX_DISABLE_SYMLINKS_OFF){fd=ngx_open_file(name->data,mode,create,access);if(fd==NGX_INVALID_FILE){of->err=ngx_errno;of->failed=ngx_open_file_n;returnNGX_INVALID_FILE;}returnfd;}p=name->data;end=p+name->len;at_name=*name;if(of->disable_symlinks_from){cp=p+of->disable_symlinks_from;*cp='\0';at_fd=ngx_open_file(p,NGX_FILE_SEARCH|NGX_FILE_NONBLOCK,NGX_FILE_OPEN,0);*cp='/';if(at_fd==NGX_INVALID_FILE){of->err=ngx_errno;of->failed=ngx_open_file_n;returnNGX_INVALID_FILE;}at_name.len=of->disable_symlinks_from;p=cp+1;}elseif(*p=='/'){at_fd=ngx_open_file("/",NGX_FILE_SEARCH|NGX_FILE_NONBLOCK,NGX_FILE_OPEN,0);if(at_fd==NGX_INVALID_FILE){of->err=ngx_errno;of->failed=ngx_openat_file_n;returnNGX_INVALID_FILE;}at_name.len=1;p++;}else{at_fd=NGX_AT_FDCWD;}for(;;){cp=ngx_strlchr(p,end,'/');if(cp==NULL){break;}if(cp==p){p++;continue;}*cp='\0';if(of->disable_symlinks==NGX_DISABLE_SYMLINKS_NOTOWNER){fd=ngx_openat_file_owner(at_fd,p,NGX_FILE_SEARCH|NGX_FILE_NONBLOCK,NGX_FILE_OPEN,0,log);}else{fd=ngx_openat_file(at_fd,p,NGX_FILE_SEARCH|NGX_FILE_NONBLOCK|NGX_FILE_NOFOLLOW,NGX_FILE_OPEN,0);}*cp='/';if(fd==NGX_INVALID_FILE){of->err=ngx_errno;of->failed=ngx_openat_file_n;gotofailed;}if(at_fd!=NGX_AT_FDCWD&&ngx_close_file(at_fd)==NGX_FILE_ERROR){ngx_log_error(NGX_LOG_ALERT,log,ngx_errno,ngx_close_file_n" \"%V\" failed",&at_name);}p=cp+1;at_fd=fd;at_name.len=cp-at_name.data;}if(p==end){/* * If pathname ends with a trailing slash, assume the last path * component is a directory and reopen it with requested flags; * if not, fail with ENOTDIR as per POSIX. * * We cannot rely on O_DIRECTORY in the loop above to check * that the last path component is a directory because * O_DIRECTORY doesn't work on FreeBSD 8. Fortunately, by * reopening a directory, we don't depend on it at all. */fd=ngx_openat_file(at_fd,".",mode,create,access);gotodone;}if(of->disable_symlinks==NGX_DISABLE_SYMLINKS_NOTOWNER&&!(create&(NGX_FILE_CREATE_OR_OPEN|NGX_FILE_TRUNCATE))){fd=ngx_openat_file_owner(at_fd,p,mode,create,access,log);}else{fd=ngx_openat_file(at_fd,p,mode|NGX_FILE_NOFOLLOW,create,access);}done:if(fd==NGX_INVALID_FILE){of->err=ngx_errno;of->failed=ngx_openat_file_n;}failed:if(at_fd!=NGX_AT_FDCWD&&ngx_close_file(at_fd)==NGX_FILE_ERROR){ngx_log_error(NGX_LOG_ALERT,log,ngx_errno,ngx_close_file_n" \"%V\" failed",&at_name);}returnfd;#endif}
p=name->data;end=p+name->len;at_name=*name;if(of->disable_symlinks_from){cp=p+of->disable_symlinks_from;*cp='\0';at_fd=ngx_open_file(p,NGX_FILE_SEARCH|NGX_FILE_NONBLOCK,NGX_FILE_OPEN,0);*cp='/';if(at_fd==NGX_INVALID_FILE){of->err=ngx_errno;of->failed=ngx_open_file_n;returnNGX_INVALID_FILE;}at_name.len=of->disable_symlinks_from;p=cp+1;}elseif(*p=='/'){at_fd=ngx_open_file("/",NGX_FILE_SEARCH|NGX_FILE_NONBLOCK,NGX_FILE_OPEN,0);if(at_fd==NGX_INVALID_FILE){of->err=ngx_errno;of->failed=ngx_openat_file_n;returnNGX_INVALID_FILE;}at_name.len=1;p++;}else{at_fd=NGX_AT_FDCWD;}for(;;){cp=ngx_strlchr(p,end,'/');if(cp==NULL){break;}if(cp==p){p++;continue;}*cp='\0';if(of->disable_symlinks==NGX_DISABLE_SYMLINKS_NOTOWNER){fd=ngx_openat_file_owner(at_fd,p,NGX_FILE_SEARCH|NGX_FILE_NONBLOCK,NGX_FILE_OPEN,0,log);}else{fd=ngx_openat_file(at_fd,p,NGX_FILE_SEARCH|NGX_FILE_NONBLOCK|NGX_FILE_NOFOLLOW,NGX_FILE_OPEN,0);}*cp='/';if(fd==NGX_INVALID_FILE){of->err=ngx_errno;of->failed=ngx_openat_file_n;gotofailed;}if(at_fd!=NGX_AT_FDCWD&&ngx_close_file(at_fd)==NGX_FILE_ERROR){ngx_log_error(NGX_LOG_ALERT,log,ngx_errno,ngx_close_file_n" \"%V\" failed",&at_name);}p=cp+1;at_fd=fd;at_name.len=cp-at_name.data;}if(p==end){/* * If pathname ends with a trailing slash, assume the last path * component is a directory and reopen it with requested flags; * if not, fail with ENOTDIR as per POSIX. * * We cannot rely on O_DIRECTORY in the loop above to check * that the last path component is a directory because * O_DIRECTORY doesn't work on FreeBSD 8. Fortunately, by * reopening a directory, we don't depend on it at all. */fd=ngx_openat_file(at_fd,".",mode,create,access);gotodone;}if(of->disable_symlinks==NGX_DISABLE_SYMLINKS_NOTOWNER&&!(create&(NGX_FILE_CREATE_OR_OPEN|NGX_FILE_TRUNCATE))){fd=ngx_openat_file_owner(at_fd,p,mode,create,access,log);}else{fd=ngx_openat_file(at_fd,p,mode|NGX_FILE_NOFOLLOW,create,access);}done:if(fd==NGX_INVALID_FILE){of->err=ngx_errno;of->failed=ngx_openat_file_n;}failed:if(at_fd!=NGX_AT_FDCWD&&ngx_close_file(at_fd)==NGX_FILE_ERROR){ngx_log_error(NGX_LOG_ALERT,log,ngx_errno,ngx_close_file_n" \"%V\" failed",&at_name);}returnfd;#endif}
MCProtocolLib数据包处理指南:从握手到游戏状态的完整流程解析 【免费下载链接】MCProtocolLib A library for communication with a Minecraft client/server. 项目地址: https://gitcode.com/gh_mirrors/mc/MCProtocolLib
MCProtocolLib是一款专为Minecraf…
WiVRn用户案例:看看其他人如何使用这个开源工具将Linux桌面VR内容流式传输到独立头显 【免费下载链接】WiVRn The Linux OpenXR streaming application to standalone headsets 项目地址: https://gitcode.com/GitHub_Trending/wi/WiVRn
WiVRn是一款功能强大…