File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -306,9 +306,10 @@ dm_get_underlying_path(const char *dm_name)
306
306
else
307
307
dev_str = tmp ;
308
308
309
- size = asprintf (& tmp , "/sys/block/%s/slaves/" , dev_str );
310
- if ( size == -1 || ! tmp )
309
+ if (( size = asprintf (& tmp , "/sys/block/%s/slaves/" , dev_str )) == -1 ) {
310
+ tmp = NULL ;
311
311
goto end ;
312
+ }
312
313
313
314
dp = opendir (tmp );
314
315
if (dp == NULL )
@@ -334,7 +335,9 @@ dm_get_underlying_path(const char *dm_name)
334
335
if (!enclosure_path )
335
336
continue ;
336
337
337
- size = asprintf (& path , "/dev/%s" , ep -> d_name );
338
+ if ((size = asprintf (
339
+ & path , "/dev/%s" , ep -> d_name )) == -1 )
340
+ path = NULL ;
338
341
free (enclosure_path );
339
342
break ;
340
343
}
@@ -352,7 +355,8 @@ dm_get_underlying_path(const char *dm_name)
352
355
* enclosure devices. Throw up out hands and return the first
353
356
* underlying path.
354
357
*/
355
- size = asprintf (& path , "/dev/%s" , first_path );
358
+ if ((size = asprintf (& path , "/dev/%s" , first_path )) == -1 )
359
+ path = NULL ;
356
360
}
357
361
358
362
free (first_path );
You can’t perform that action at this time.
0 commit comments