libbb: remove is_directory's argument which is always NULL
function old new delta send_cgi_and_exit 892 890 -2 ln_main 447 445 -2 handle_incoming_and_exit 2784 2780 -4 is_directory 66 59 -7 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/6 up/down: 2/-19) Total: -15 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
f85bd1a7a7
commit
f282c6b657
@ -69,8 +69,8 @@ int ln_main(int argc, char **argv)
|
|||||||
src = last;
|
src = last;
|
||||||
|
|
||||||
if (is_directory(src,
|
if (is_directory(src,
|
||||||
(opts & LN_NODEREFERENCE) ^ LN_NODEREFERENCE,
|
(opts & LN_NODEREFERENCE) ^ LN_NODEREFERENCE
|
||||||
NULL)
|
)
|
||||||
) {
|
) {
|
||||||
src_name = xstrdup(*argv);
|
src_name = xstrdup(*argv);
|
||||||
src = concat_path_file(src, bb_get_last_path_component_strip(src_name));
|
src = concat_path_file(src, bb_get_last_path_component_strip(src_name));
|
||||||
|
@ -314,7 +314,7 @@ extern char *strrstr(const char *haystack, const char *needle) FAST_FUNC;
|
|||||||
|
|
||||||
//TODO: supply a pointer to char[11] buffer (avoid statics)?
|
//TODO: supply a pointer to char[11] buffer (avoid statics)?
|
||||||
extern const char *bb_mode_string(mode_t mode) FAST_FUNC;
|
extern const char *bb_mode_string(mode_t mode) FAST_FUNC;
|
||||||
extern int is_directory(const char *name, int followLinks, struct stat *statBuf) FAST_FUNC;
|
extern int is_directory(const char *name, int followLinks) FAST_FUNC;
|
||||||
enum { /* DO NOT CHANGE THESE VALUES! cp.c, mv.c, install.c depend on them. */
|
enum { /* DO NOT CHANGE THESE VALUES! cp.c, mv.c, install.c depend on them. */
|
||||||
FILEUTILS_PRESERVE_STATUS = 1 << 0, /* -p */
|
FILEUTILS_PRESERVE_STATUS = 1 << 0, /* -p */
|
||||||
FILEUTILS_DEREFERENCE = 1 << 1, /* !-d */
|
FILEUTILS_DEREFERENCE = 1 << 1, /* !-d */
|
||||||
|
@ -15,22 +15,17 @@
|
|||||||
* Return TRUE if fileName is a directory.
|
* Return TRUE if fileName is a directory.
|
||||||
* Nonexistent files return FALSE.
|
* Nonexistent files return FALSE.
|
||||||
*/
|
*/
|
||||||
int FAST_FUNC is_directory(const char *fileName, int followLinks, struct stat *statBuf)
|
int FAST_FUNC is_directory(const char *fileName, int followLinks)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
struct stat astatBuf;
|
struct stat statBuf;
|
||||||
|
|
||||||
if (statBuf == NULL) {
|
|
||||||
/* use auto stack buffer */
|
|
||||||
statBuf = &astatBuf;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (followLinks)
|
if (followLinks)
|
||||||
status = stat(fileName, statBuf);
|
status = stat(fileName, &statBuf);
|
||||||
else
|
else
|
||||||
status = lstat(fileName, statBuf);
|
status = lstat(fileName, &statBuf);
|
||||||
|
|
||||||
status = (status == 0 && S_ISDIR(statBuf->st_mode));
|
status = (status == 0 && S_ISDIR(statBuf.st_mode));
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -1302,7 +1302,7 @@ static void send_cgi_and_exit(
|
|||||||
while ((script = strchr(script + 1, '/')) != NULL) {
|
while ((script = strchr(script + 1, '/')) != NULL) {
|
||||||
int dir;
|
int dir;
|
||||||
*script = '\0';
|
*script = '\0';
|
||||||
dir = is_directory(url + 1, /*followlinks:*/ 1, NULL);
|
dir = is_directory(url + 1, /*followlinks:*/ 1);
|
||||||
*script = '/';
|
*script = '/';
|
||||||
if (!dir) {
|
if (!dir) {
|
||||||
/* not directory, found script.cgi/PATH_INFO */
|
/* not directory, found script.cgi/PATH_INFO */
|
||||||
@ -2048,7 +2048,7 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
|
|||||||
|
|
||||||
/* If URL is a directory, add '/' */
|
/* If URL is a directory, add '/' */
|
||||||
if (urlp[-1] != '/') {
|
if (urlp[-1] != '/') {
|
||||||
if (is_directory(urlcopy + 1, 1, NULL)) {
|
if (is_directory(urlcopy + 1, /*followlinks:*/ 1)) {
|
||||||
found_moved_temporarily = urlcopy;
|
found_moved_temporarily = urlcopy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2062,7 +2062,7 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
|
|||||||
while (ip_allowed && (tptr = strchr(tptr + 1, '/')) != NULL) {
|
while (ip_allowed && (tptr = strchr(tptr + 1, '/')) != NULL) {
|
||||||
/* have path1/path2 */
|
/* have path1/path2 */
|
||||||
*tptr = '\0';
|
*tptr = '\0';
|
||||||
if (is_directory(urlcopy + 1, 1, NULL)) {
|
if (is_directory(urlcopy + 1, /*followlinks:*/ 1)) {
|
||||||
/* may have subdir config */
|
/* may have subdir config */
|
||||||
parse_conf(urlcopy + 1, SUBDIR_PARSE);
|
parse_conf(urlcopy + 1, SUBDIR_PARSE);
|
||||||
ip_allowed = checkPermIP();
|
ip_allowed = checkPermIP();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user