lsblk: fix readlink() usage

Reported-by: Steve Grubb <sgrubb@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2011-02-18 14:36:04 +01:00
parent 5b7cb8687f
commit cc6b1d11ea
2 changed files with 2 additions and 3 deletions

View File

@ -768,7 +768,7 @@ static int process_one_device(char *devname)
{
struct blkdev_cxt parent = {}, cxt = {};
struct stat st;
char buf[PATH_MAX];
char buf[PATH_MAX + 1];
dev_t disk = 0;
if (stat(devname, &st) || !S_ISBLK(st.st_mode)) {
@ -795,7 +795,7 @@ static int process_one_device(char *devname)
major(st.st_rdev), minor(st.st_rdev));
diskname = xstrdup(buf);
len = readlink(path, buf, sizeof(buf));
len = readlink(path, buf, PATH_MAX);
if (len < 0) {
warn(_("%s: failed to read link"), path);
return EXIT_FAILURE;

View File

@ -1 +0,0 @@
.so man3/uuid_generate.3