Projects
openEuler:24.03:SP1:Everything
which
_service:tar_scm:0001-which-fails-for-long-path...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:0001-which-fails-for-long-path.patch of Package which
From 77420bf2e35444f348b19e0acaf1f77bb4ed3f76 Mon Sep 17 00:00:00 2001 From: fandeyuan <fandeyuan@kylinos.cn> Date: Tue, 30 Apr 2024 14:18:20 +0800 Subject: [PATCH] which fails for long path --- which.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/which.c b/which.c index 1606052..525c0d0 100644 --- a/which.c +++ b/which.c @@ -19,10 +19,15 @@ #include "sys.h" #include <stdio.h> #include <ctype.h> +#include <limits.h> #include "getopt.h" #include "tilde/tilde.h" #include "bash.h" +#ifndef PATH_MAX +#define PATH_MAX 4096 +#endif + static const char *progname; static void print_usage(FILE *out) @@ -63,7 +68,7 @@ static void print_fail(const char *name, const char *path_list) fprintf(stderr, "%s: no %s in (%s)\n", progname, name, path_list); } -static char home[256]; +static char home[PATH_MAX]; static size_t homelen = 0; static int absolute_path_given; @@ -162,7 +167,7 @@ static char *find_command_in_path(const char *name, const char *path_list, int * return (found); } -static char cwd[256]; +static char cwd[PATH_MAX]; static size_t cwdlen; static void get_current_working_directory(void) @@ -194,7 +199,7 @@ static void get_current_working_directory(void) static char *path_clean_up(const char *path) { - static char result[256]; + static char result[PATH_MAX]; const char *p1 = path; char *p2 = result; -- 2.33.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2