src = last;
if (is_directory(src,
- (opts & LN_NODEREFERENCE) ^ LN_NODEREFERENCE,
- NULL)
+ (opts & LN_NODEREFERENCE) ^ LN_NODEREFERENCE
+ )
) {
src_name = xstrdup(*argv);
src = concat_path_file(src, bb_get_last_path_component_strip(src_name));
//TODO: supply a pointer to char[11] buffer (avoid statics)?
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. */
FILEUTILS_PRESERVE_STATUS = 1 << 0, /* -p */
FILEUTILS_DEREFERENCE = 1 << 1, /* !-d */
* Return TRUE if fileName is a directory.
* 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;
- struct stat astatBuf;
-
- if (statBuf == NULL) {
- /* use auto stack buffer */
- statBuf = &astatBuf;
- }
+ struct stat statBuf;
if (followLinks)
- status = stat(fileName, statBuf);
+ status = stat(fileName, &statBuf);
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;
}
while ((script = strchr(script + 1, '/')) != NULL) {
int dir;
*script = '\0';
- dir = is_directory(url + 1, /*followlinks:*/ 1, NULL);
+ dir = is_directory(url + 1, /*followlinks:*/ 1);
*script = '/';
if (!dir) {
/* not directory, found script.cgi/PATH_INFO */
/* If URL is a directory, add '/' */
if (urlp[-1] != '/') {
- if (is_directory(urlcopy + 1, 1, NULL)) {
+ if (is_directory(urlcopy + 1, /*followlinks:*/ 1)) {
found_moved_temporarily = urlcopy;
}
}
while (ip_allowed && (tptr = strchr(tptr + 1, '/')) != NULL) {
/* have path1/path2 */
*tptr = '\0';
- if (is_directory(urlcopy + 1, 1, NULL)) {
+ if (is_directory(urlcopy + 1, /*followlinks:*/ 1)) {
/* may have subdir config */
parse_conf(urlcopy + 1, SUBDIR_PARSE);
ip_allowed = checkPermIP();