fdisk_SOURCES = fdisk.c fdiskbsdlabel.c fdisksgilabel.c \
fdisksunlabel.c fdiskaixlabel.c fdiskmaclabel.c partname.c \
fdisk.h fdisksunlabel.h fdisksgilabel.h fdiskaixlabel.h \
- fdiskbsdlabel.h fdiskmaclabel.h $(fdisk_common)
+ fdiskbsdlabel.h fdiskmaclabel.h $(fdisk_common) \
+ $(top_srcdir)/lib/canonicalize.c
cflags_blkid = $(AM_CFLAGS)
ldadd_blkid =
sbin_PROGRAMS += sfdisk
dist_man_MANS += sfdisk.8
-sfdisk_SOURCES = sfdisk.c partname.c $(fdisk_common)
+sfdisk_SOURCES = sfdisk.c partname.c $(fdisk_common) \
+ $(top_srcdir)/lib/canonicalize.c
if HAVE_STATIC_SFDISK
sbin_PROGRAMS += sfdisk.static
#include "mbsalign.h"
#include "fdisk.h"
#include "wholedisk.h"
+#include "pathnames.h"
+#include "canonicalize.h"
#include "fdisksunlabel.h"
#include "fdisksgilabel.h"
int ma, mi;
unsigned long long sz;
- procpt = fopen(PROC_PARTITIONS, "r");
+ procpt = fopen(_PATH_PROC_PARTITIONS, "r");
if (procpt == NULL) {
- fprintf(stderr, _("cannot open %s\n"), PROC_PARTITIONS);
+ fprintf(stderr, _("cannot open %s\n"), _PATH_PROC_PARTITIONS);
return;
}
&ma, &mi, &sz, ptname) != 4)
continue;
snprintf(devname, sizeof(devname), "/dev/%s", ptname);
- if (is_whole_disk(devname))
- try(devname, 0);
+ if (is_whole_disk(devname)) {
+ char *cn = canonicalize_path(devname);
+ if (cn) {
+ try(cn, 0);
+ free(cn);
+ }
+ }
}
fclose(procpt);
}
/* prototypes for fdisksgilabel.c */
extern int valid_part_table_flag(unsigned char *b);
-#define PROC_PARTITIONS "/proc/partitions"
#include "common.h"
#include "wholedisk.h"
#include "gpt.h"
+#include "pathnames.h"
+#include "canonicalize.h"
/*
* Table of contents:
return is_ide;
}
-#define PROC_PARTITIONS "/proc/partitions"
-
static char *
nextproc(FILE *procf) {
static char devname[256];
snprintf(devname, sizeof(devname), "/dev/%s", ptname);
if (!is_whole_disk(devname))
continue;
- return devname;
+ return canonicalize_path(devname);
}
return NULL;
/* try all known devices */
total_size = 0;
- procf = fopen(PROC_PARTITIONS, "r");
+ procf = fopen(_PATH_PROC_PARTITIONS, "r");
if (!procf)
- fprintf(stderr, _("cannot open %s\n"), PROC_PARTITIONS);
+ fprintf(stderr, _("cannot open %s\n"), _PATH_PROC_PARTITIONS);
else {
while ((dev = nextproc(procf)) != NULL) {
- if (is_ide_cdrom_or_tape(dev))
- continue;
- gpt_warning(dev, 1);
- if (opt_out_geom)
- do_geom(dev, 1);
- if (opt_out_pt_geom)
- do_pt_geom(dev, 1);
- if (opt_size)
- do_size(dev, 1);
- if (opt_list || verify)
- do_list(dev, 1);
+ if (!is_ide_cdrom_or_tape(dev)) {
+ gpt_warning(dev, 1);
+ if (opt_out_geom)
+ do_geom(dev, 1);
+ if (opt_out_pt_geom)
+ do_pt_geom(dev, 1);
+ if (opt_size)
+ do_size(dev, 1);
+ if (opt_list || verify)
+ do_list(dev, 1);
+ }
+ free(dev);
}
fclose(procf);
}