I did this one change by reading the code
but did not tried to run it.
Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
static int fdname(int fd, char *name, size_t size)
{
char path[MAXPATHLEN];
static int fdname(int fd, char *name, size_t size)
{
char path[MAXPATHLEN];
snprintf(path, MAXPATHLEN, "/proc/self/fd/%d", fd);
snprintf(path, MAXPATHLEN, "/proc/self/fd/%d", fd);
- return readlink(path, name, size) < 0 ? -1 : 0;
+ len = readlink(path, name, size);
+ if (len > 0)
+ path[len] = '\0';
+
+ return (len <= 0) ? -1 : 0;
}
static int console_init(char *console, size_t size)
}
static int console_init(char *console, size_t size)