aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-07-23 08:51:41 +0000
committermerakor <cem@ckyln.com>2020-07-23 08:51:41 +0000
commit22ccf8218e2b3fa36d697ea37af34c49fb08563d (patch)
treebf8700c02263c722b2e20397f0ada5372a8ee8e4
parentcab7e88f57931fbc9130967287e8593a47f29064 (diff)
downloadcpt-22ccf8218e2b3fa36d697ea37af34c49fb08563d.tar.gz
kiss-readlink: define DIR_MAX for the dname array
FossilOrigin-Name: 7d9868704c78e77a169dee8b113bd7f2030903e26785e89afa55ad8136cba882
-rw-r--r--bin/kiss-readlink.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bin/kiss-readlink.c b/bin/kiss-readlink.c
index e65c0d9..cc6c8ff 100644
--- a/bin/kiss-readlink.c
+++ b/bin/kiss-readlink.c
@@ -9,6 +9,8 @@
#include <string.h>
#include <limits.h>
+#define DIR_MAX PATH_MAX - NAME_MAX - 1
+
char *realpath(const char *path, char *resolved_path);
@@ -22,7 +24,7 @@ main(int argc, char *argv[])
* use directories above the file. We are using dname and bname so that
* they don't clash with the functions with the same name.
*/
- char dname[PATH_MAX]; /* directory name */
+ char dname[DIR_MAX]; /* directory name */
char bname[NAME_MAX]; /* base name */
sprintf(bname, "%s", (basename(argv[1])));