convert mtab literal ipv6 cifs url for unmount from mountpoint #46
This commit is contained in:
parent
36b06ba7d1
commit
6baf1702ab
22
src/udevil.c
22
src/udevil.c
|
@ -1391,7 +1391,7 @@ static char* get_ip( const char* hostname )
|
|||
struct addrinfo *result;
|
||||
char* ret = NULL;
|
||||
|
||||
if ( !hostname )
|
||||
if ( !( hostname && hostname[0] ) )
|
||||
return NULL;
|
||||
|
||||
memset( &hints, 0, sizeof( struct addrinfo ) );
|
||||
|
@ -3005,8 +3005,28 @@ _get_type:
|
|||
{
|
||||
if ( g_strcmp0( data->device_file, "tmpfs" ) &&
|
||||
g_strcmp0( data->device_file, "ramfs" ) )
|
||||
{
|
||||
// found device file of mountpoint
|
||||
if ( g_str_has_prefix( data->device_file, "//" ) &&
|
||||
strchr( data->device_file, ':' ) &&
|
||||
data->device_file[2] != '[' )
|
||||
{
|
||||
// unmounting mountpoint of cifs with ipv6 literal
|
||||
// cifs ipv6 mtab format: //::1/share
|
||||
// add literal brackets: //[::1]/share
|
||||
str = g_strdup( data->device_file + 2 );
|
||||
if ( str2 = strchr( str, '/' ) )
|
||||
str2[0] = '\0';
|
||||
g_free( data->device_file );
|
||||
data->device_file = g_strdup_printf( "//[%s]%s%s",
|
||||
str,
|
||||
str2 ? "/" : "",
|
||||
str2 ? str2 + 1 : "" );
|
||||
g_free( str );
|
||||
}
|
||||
goto _get_type;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wlog( _("udevil: error 46: cannot find '%s' mounted in mtab\n"),
|
||||
|
|
Loading…
Reference in New Issue
Block a user