daemon: Fix part-to-dev when the partition name includes p<N>.

If the device name ends with a number, Linux uses partition names of
the form <device>p<N>.  Handle this case by knocking off the 'p'
character.
This commit is contained in:
Pino Toscano
2017-01-19 11:00:21 +00:00
committed by Richard W.M. Jones
parent 5c350db94d
commit 6fd2ddb350

View File

@@ -203,6 +203,9 @@ do_part_to_dev (const char *part)
return NULL;
}
if (part[n-1] == 'p')
n--;
char *r = strndup (part, n);
if (r == NULL) {
reply_with_perror ("strdup");