mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
use g_path_get_basename instead of basename
basename(3) and dirname(3) modify their argument and may return pointers to statically allocated memory which may be overwritten by subsequent calls. g_path_get_basename and g_path_get_dirname have no such issues, and therefore more preferable. Signed-off-by: Julia Suvorova <jusual@mail.ru> Message-Id: <1519888086-4207-1-git-send-email-jusual@mail.ru> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
4060e671c3
commit
3e015d815b
6 changed files with 15 additions and 12 deletions
|
@ -48,7 +48,7 @@ static void s390_ccw_get_dev_info(S390CCWDevice *cdev,
|
|||
return;
|
||||
}
|
||||
|
||||
cdev->mdevid = g_strdup(basename(dev_path));
|
||||
cdev->mdevid = g_path_get_basename(dev_path);
|
||||
|
||||
tmp = basename(dirname(dev_path));
|
||||
if (sscanf(tmp, "%2x.%1x.%4x", &cssid, &ssid, &devid) != 3) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue