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