Remove apathmax() and implicitly agetcwd()
pathconf() is just an insane interface to use. All sane operating- systems set sane values for PATH_MAX. Due to the by-runtime-nature of pathconf(), it actually weakens the programs depending on its values. Given over 3 years it has still not been possible to implement a sane and easy to use apathmax()-utility-function, and after discussing this on IRC, we'll dump this garbage. We are careful enough not to overflow PATH_MAX and even if, any user is able to set another limit in config.mk if he so desires.
This commit is contained in:
6
ls.c
6
ls.c
@@ -192,9 +192,10 @@ lsdir(const char *path)
|
||||
struct entry ent, *ents = NULL;
|
||||
struct dirent *d;
|
||||
size_t i, n = 0, len;
|
||||
char *cwd, *p, *q, *name;
|
||||
char cwd[PATH_MAX], *p, *q, *name;
|
||||
|
||||
cwd = agetcwd();
|
||||
if (!getcwd(cwd, sizeof(cwd)))
|
||||
eprintf("getcwd:");
|
||||
if (!(dp = opendir(path)))
|
||||
eprintf("opendir %s:", path);
|
||||
if (chdir(path) < 0)
|
||||
@@ -247,7 +248,6 @@ lsdir(const char *path)
|
||||
if (chdir(cwd) < 0)
|
||||
eprintf("chdir %s:", cwd);
|
||||
free(ents);
|
||||
free(cwd);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user