From: Svante Signell <svante.signell@gmail.com>
Currently shadow fails to build from source and is flagged as out-of-date. This is due to a usage of PATH_MAX, which is not defined on GNU/Hurd. The attached patch solves this problem by allocating a fixed number of 32 bytes for the string proc_dir_name in files src/procuidmap.c and src/procgidmap.c. (In fact only 18 bytes are needed) Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
parent
980c804153
commit
4911773b77
@ -94,7 +94,7 @@ static void usage(void)
|
|||||||
*/
|
*/
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char proc_dir_name[PATH_MAX];
|
char proc_dir_name[32];
|
||||||
char *target_str;
|
char *target_str;
|
||||||
pid_t target, parent;
|
pid_t target, parent;
|
||||||
int proc_dir_fd;
|
int proc_dir_fd;
|
||||||
@ -120,6 +120,7 @@ int main(int argc, char **argv)
|
|||||||
if (!get_pid(target_str, &target))
|
if (!get_pid(target_str, &target))
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
|
/* max string length is 6 + 10 + 1 + 1 = 18, allocate 32 bytes */
|
||||||
written = snprintf(proc_dir_name, sizeof(proc_dir_name), "/proc/%u/",
|
written = snprintf(proc_dir_name, sizeof(proc_dir_name), "/proc/%u/",
|
||||||
target);
|
target);
|
||||||
if ((written <= 0) || (written >= sizeof(proc_dir_name))) {
|
if ((written <= 0) || (written >= sizeof(proc_dir_name))) {
|
||||||
|
@ -94,7 +94,7 @@ void usage(void)
|
|||||||
*/
|
*/
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char proc_dir_name[PATH_MAX];
|
char proc_dir_name[32];
|
||||||
char *target_str;
|
char *target_str;
|
||||||
pid_t target, parent;
|
pid_t target, parent;
|
||||||
int proc_dir_fd;
|
int proc_dir_fd;
|
||||||
@ -120,6 +120,7 @@ int main(int argc, char **argv)
|
|||||||
if (!get_pid(target_str, &target))
|
if (!get_pid(target_str, &target))
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
|
/* max string length is 6 + 10 + 1 + 1 = 18, allocate 32 bytes */
|
||||||
written = snprintf(proc_dir_name, sizeof(proc_dir_name), "/proc/%u/",
|
written = snprintf(proc_dir_name, sizeof(proc_dir_name), "/proc/%u/",
|
||||||
target);
|
target);
|
||||||
if ((written <= 0) || (written >= sizeof(proc_dir_name))) {
|
if ((written <= 0) || (written >= sizeof(proc_dir_name))) {
|
||||||
|
Loading…
Reference in New Issue
Block a user