summaryrefslogtreecommitdiffstats
path: root/misc-utils/lsblk.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc-utils/lsblk.c')
-rw-r--r--misc-utils/lsblk.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
index 5c065a903..c9a39b36e 100644
--- a/misc-utils/lsblk.c
+++ b/misc-utils/lsblk.c
@@ -56,7 +56,6 @@
#include "nls.h"
#include "xalloc.h"
#include "strutils.h"
-#include "at.h"
#include "sysfs.h"
#include "closestream.h"
#include "mangle.h"
@@ -1320,15 +1319,14 @@ static int list_partitions(struct blkdev_cxt *wholedisk_cxt, struct blkdev_cxt *
return r;
}
-static int get_wholedisk_from_partition_dirent(DIR *dir, const char *dirname,
+static int get_wholedisk_from_partition_dirent(DIR *dir,
struct dirent *d, struct blkdev_cxt *cxt)
{
char path[PATH_MAX];
char *p;
int len;
- if ((len = readlink_at(dirfd(dir), dirname,
- d->d_name, path, sizeof(path) - 1)) < 0)
+ if ((len = readlinkat(dirfd(dir), d->d_name, path, sizeof(path) - 1)) < 0)
return 0;
path[len] = '\0';
@@ -1355,7 +1353,6 @@ static int list_deps(struct blkdev_cxt *cxt)
DIR *dir;
struct dirent *d;
struct blkdev_cxt dep = { 0 };
- char dirname[PATH_MAX];
const char *depname;
assert(cxt);
@@ -1375,12 +1372,10 @@ static int list_deps(struct blkdev_cxt *cxt)
DBG(CXT, ul_debugobj(cxt, "%s: checking for '%s' dependence", cxt->name, depname));
- snprintf(dirname, sizeof(dirname), "%s/%s", cxt->sysfs.dir_path, depname);
-
while ((d = xreaddir(dir))) {
/* Is the dependency a partition? */
if (sysfs_is_partition_dirent(dir, d, NULL)) {
- if (!get_wholedisk_from_partition_dirent(dir, dirname, d, &dep)) {
+ if (!get_wholedisk_from_partition_dirent(dir, d, &dep)) {
DBG(CXT, ul_debugobj(cxt, "%s: %s: dependence is partition",
cxt->name, d->d_name));
process_blkdev(&dep, cxt, 1, d->d_name);