Skip to content

Commit ce48ce3

Browse files
committed
added VT_PATH_MAX for consistency
1 parent d224a90 commit ce48ce3

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

inc/vita/system/path.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@
5757
#define VT_DIR_PERMISSIONS (S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)
5858
#endif
5959

60+
/// max path length
61+
#define VT_PATH_MAX 4096
62+
6063
/** Builds path from raw C strings
6164
@param s vt_str_t instance (if `NULL` is passed, vt_str_t is allocated)
6265
@param p array of raw C strings

src/vita/system/path.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -498,21 +498,21 @@ vt_str_t *vt_path_expand_tilda(const char *const z, struct VitaBaseAllocatorType
498498
}
499499

500500
vt_str_t *vt_path_get_this_exe_location(struct VitaBaseAllocatorType *alloctr) {
501-
vt_str_t *spath = vt_str_create_capacity(PATH_MAX, alloctr);
501+
vt_str_t *spath = vt_str_create_capacity(VT_PATH_MAX, alloctr);
502502
if (spath == NULL) {
503503
VT_DEBUG_PRINTF("%s\n", vt_status_to_str(VT_STATUS_ERROR_ALLOCATION));
504504
return NULL;
505505
}
506506

507507
// retrieve this exe path
508508
int64_t pathLen = 0;
509-
char buffer[PATH_MAX] = {0};
509+
char buffer[VT_PATH_MAX] = {0};
510510
#if defined(_WIN32) || defined(_WIN64)
511-
pathLen = GetModuleFileName(NULL, buffer, PATH_MAX);
511+
pathLen = GetModuleFileName(NULL, buffer, VT_PATH_MAX);
512512
#elif defined(__APPLE__) || defined(__MACH__)
513-
pathLen = proc_pidpath(getpid(), buffer, PATH_MAX);
513+
pathLen = proc_pidpath(getpid(), buffer, VT_PATH_MAX);
514514
#else
515-
pathLen = readlink("/proc/self/exe", buffer, PATH_MAX);
515+
pathLen = readlink("/proc/self/exe", buffer, VT_PATH_MAX);
516516
#endif
517517

518518
// check for errors

0 commit comments

Comments
 (0)