From: short <> Date: Sun, 21 Dec 2003 21:28:31 +0000 (+0000) Subject: +Support '/dev/ataraid/d0p1' device naming. X-Git-Tag: captive-1_1_5~19 X-Git-Url: https://git.jankratochvil.net/?p=captive.git;a=commitdiff_plain;h=e1777610bb11015e58d286ffc5732c79f9878e75 +Support '/dev/ataraid/d0p1' device naming. +Display human readable 'parent partition' open error message. --- diff --git a/src/libcaptive/storage/relastblock.c b/src/libcaptive/storage/relastblock.c index 903d838..f7aa7fa 100644 --- a/src/libcaptive/storage/relastblock.c +++ b/src/libcaptive/storage/relastblock.c @@ -146,9 +146,13 @@ GIOChannel *iochannel_subrange_new; /* /dev/ide/host0/bus0/target0/lun0/part1 -> /dev/ide/host0/bus0/target0/lun0/disc */ slashpart_prefix="/part"; - if (!strcmp(linknum-strlen(slashpart_prefix),slashpart_prefix)) + if (linknum>linkbuf+strlen(slashpart_prefix) && !strcmp(linknum-strlen(slashpart_prefix),slashpart_prefix)) strcpy(linknum-strlen(slashpart_prefix),"/disc"); + /* /dev/ataraid/d0p1 -> /dev/ataraid/d0 */ + if (linknum>=linkbuf+2 && linknum[-1]=='p' && isdigit(linknum[-2])) + *--linknum='\0'; + iochannel_flags=g_io_channel_get_flags(iochannel); switch (iochannel_flags & (G_IO_FLAG_IS_READABLE|G_IO_FLAG_IS_WRITEABLE)) { case G_IO_FLAG_IS_READABLE: @@ -160,11 +164,11 @@ GIOChannel *iochannel_subrange_new; default: g_assert_not_reached(); } - iochannel_unix_new=g_io_channel_new_file( + if (!(iochannel_unix_new=g_io_channel_new_file( linkbuf, /* filename */ iochannel_unix_new_mode, /* mode */ - NULL); /* error */ - g_assert(iochannel_unix_new!=NULL); + NULL))) /* error */ + g_error(_("Parent partition \"%s\" not readable by mode \"%s\""),linkbuf,iochannel_unix_new_mode); /* 'iochannel_unix_new' sanity checks: */ iochannel_unix_new_fd=captive_iounixchannel_get_fd(iochannel_unix_new);