Blame SOURCES/0220-RHBZ-1448223-fix-kpartx.patch
|
|
45d01a |
---
|
|
|
45d01a |
kpartx/kpartx.c | 23 ++++++++++++++++-------
|
|
|
45d01a |
1 file changed, 16 insertions(+), 7 deletions(-)
|
|
|
45d01a |
|
|
|
45d01a |
Index: multipath-tools-130222/kpartx/kpartx.c
|
|
|
45d01a |
===================================================================
|
|
|
45d01a |
--- multipath-tools-130222.orig/kpartx/kpartx.c
|
|
|
45d01a |
+++ multipath-tools-130222/kpartx/kpartx.c
|
|
|
45d01a |
@@ -114,10 +114,13 @@ set_delimiter (char * device, char * del
|
|
|
45d01a |
{
|
|
|
45d01a |
char * p = device;
|
|
|
45d01a |
|
|
|
45d01a |
- while (*(p++) != 0x0)
|
|
|
45d01a |
+ if (*p == 0x0)
|
|
|
45d01a |
+ return;
|
|
|
45d01a |
+
|
|
|
45d01a |
+ while (*(++p) != 0x0)
|
|
|
45d01a |
continue;
|
|
|
45d01a |
|
|
|
45d01a |
- if (isdigit(*(p - 2)))
|
|
|
45d01a |
+ if (isdigit(*(p - 1)))
|
|
|
45d01a |
*delimiter = 'p';
|
|
|
45d01a |
}
|
|
|
45d01a |
|
|
|
45d01a |
@@ -136,15 +139,17 @@ strip_slash (char * device)
|
|
|
45d01a |
static int
|
|
|
45d01a |
find_devname_offset (char * device)
|
|
|
45d01a |
{
|
|
|
45d01a |
- char *p, *q = NULL;
|
|
|
45d01a |
+ char *p, *q;
|
|
|
45d01a |
|
|
|
45d01a |
- p = device;
|
|
|
45d01a |
+ q = p = device;
|
|
|
45d01a |
|
|
|
45d01a |
- while (*p++)
|
|
|
45d01a |
+ while (*p) {
|
|
|
45d01a |
if (*p == '/')
|
|
|
45d01a |
- q = p;
|
|
|
45d01a |
+ q = p + 1;
|
|
|
45d01a |
+ p++;
|
|
|
45d01a |
+ }
|
|
|
45d01a |
|
|
|
45d01a |
- return (int)(q - device) + 1;
|
|
|
45d01a |
+ return (int)(q - device);
|
|
|
45d01a |
}
|
|
|
45d01a |
|
|
|
45d01a |
static char *
|
|
|
45d01a |
@@ -343,6 +348,10 @@ main(int argc, char **argv){
|
|
|
45d01a |
}
|
|
|
45d01a |
device = loopdev;
|
|
|
45d01a |
}
|
|
|
45d01a |
+ else if (!S_ISBLK(buf.st_mode)) {
|
|
|
45d01a |
+ fprintf(stderr, "invalid device: %s\n", device);
|
|
|
45d01a |
+ exit(1);
|
|
|
45d01a |
+ }
|
|
|
45d01a |
|
|
|
45d01a |
off = find_devname_offset(device);
|
|
|
45d01a |
|