cmd: s/MAXPATHLEN/PATH_MAX/g

parent 8634b8a9
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <errno.h> #include <errno.h>
#include <getopt.h> #include <getopt.h>
#include <libgen.h> #include <libgen.h>
#include <limits.h>
#include <pthread.h> #include <pthread.h>
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
...@@ -108,7 +109,7 @@ static void prevent_forking(void) ...@@ -108,7 +109,7 @@ static void prevent_forking(void)
FILE *f; FILE *f;
size_t len = 0; size_t len = 0;
char *line = NULL; char *line = NULL;
char path[MAXPATHLEN]; char path[PATH_MAX];
f = fopen("/proc/self/cgroup", "r"); f = fopen("/proc/self/cgroup", "r");
if (!f) if (!f)
...@@ -202,10 +203,10 @@ static void remove_self(void) ...@@ -202,10 +203,10 @@ static void remove_self(void)
{ {
int ret; int ret;
ssize_t n; ssize_t n;
char path[MAXPATHLEN] = {0}; char path[PATH_MAX] = {0};
n = readlink("/proc/self/exe", path, sizeof(path)); n = readlink("/proc/self/exe", path, sizeof(path));
if (n < 0 || n >= MAXPATHLEN) { if (n < 0 || n >= PATH_MAX) {
SYSDEBUG("Failed to readlink \"/proc/self/exe\""); SYSDEBUG("Failed to readlink \"/proc/self/exe\"");
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment