2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 18:07:57 +00:00

pipe: Shorten array for self link path

To open /proc/self/fd/%d PATH_MAX array is too long :) We can use shorter.
Plus fix the snprintf size argument.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov 2012-07-11 12:57:19 +04:00
parent d271850694
commit f965ead8b8

View File

@ -169,7 +169,7 @@ err:
static int recv_pipe_fd(struct pipe_info *pi) static int recv_pipe_fd(struct pipe_info *pi)
{ {
struct fdinfo_list_entry *fle; struct fdinfo_list_entry *fle;
char path[PATH_MAX]; char path[32];
int tmp, fd; int tmp, fd;
fle = file_master(&pi->d); fle = file_master(&pi->d);
@ -184,7 +184,7 @@ static int recv_pipe_fd(struct pipe_info *pi)
} }
close(fd); close(fd);
snprintf(path, PATH_MAX, "/proc/self/fd/%d", tmp); snprintf(path, sizeof(path), "/proc/self/fd/%d", tmp);
fd = open(path, pi->pe.flags); fd = open(path, pi->pe.flags);
close(tmp); close(tmp);