replace readdir_r with readdir in guestSvrUtil.cpp
Reasons: * readdir_r has been deprecated from glibc 2.24. Detailed reasons can be found at below link. http://man7.org/linux/man-pages/man3/readdir_r.3.html * StarlingX devstack has switched to Ubuntu Bionic. By default, gcc version is 7.3.0, glibc version is 2.27. Using readdir_r in mtce-guest will cause compiling failure. Passed tests: * Fresh building * Deployment test * Function-level unit tests. Modfied guestUtil_load_channels and guestUtil_channel_search have same output as previous ones. * System-level verification. guestServer&guestAgent can start successfully. By checking the log of guestServer, it has the same content as before. Story: 2003163 Task: 29689 Change-Id: Ib77decf495f093651ac93ef1e0ce2be3807ce91b Signed-off-by: Yi Wang <yi.c.wang@intel.com>
This commit is contained in:
parent
116b10b7c6
commit
b1db929bf7
@ -76,7 +76,6 @@ int guestUtil_close_channel ( instInfo * instInfo_ptr )
|
|||||||
void guestUtil_load_channels ( void )
|
void guestUtil_load_channels ( void )
|
||||||
{
|
{
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
struct dirent entry;
|
|
||||||
struct dirent *result;
|
struct dirent *result;
|
||||||
|
|
||||||
dirp = opendir(QEMU_CHANNEL_DIR);
|
dirp = opendir(QEMU_CHANNEL_DIR);
|
||||||
@ -87,11 +86,8 @@ void guestUtil_load_channels ( void )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
dlog ("Searching %s directory\n", QEMU_CHANNEL_DIR);
|
dlog ("Searching %s directory\n", QEMU_CHANNEL_DIR);
|
||||||
while(0 == readdir_r(dirp, &entry, &result))
|
while ((result = readdir(dirp)) != NULL)
|
||||||
{
|
{
|
||||||
if (!result)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if ( virtio_check_filename (result->d_name) )
|
if ( virtio_check_filename (result->d_name) )
|
||||||
{
|
{
|
||||||
string channel = result->d_name ;
|
string channel = result->d_name ;
|
||||||
@ -125,7 +121,6 @@ void guestUtil_load_channels ( void )
|
|||||||
void guestUtil_channel_search ( void )
|
void guestUtil_channel_search ( void )
|
||||||
{
|
{
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
struct dirent entry;
|
|
||||||
struct dirent *result;
|
struct dirent *result;
|
||||||
|
|
||||||
dirp = opendir(QEMU_CHANNEL_DIR);
|
dirp = opendir(QEMU_CHANNEL_DIR);
|
||||||
@ -136,11 +131,8 @@ void guestUtil_channel_search ( void )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
dlog ("Searching %s directory\n", QEMU_CHANNEL_DIR);
|
dlog ("Searching %s directory\n", QEMU_CHANNEL_DIR);
|
||||||
while(0 == readdir_r(dirp, &entry, &result))
|
while ((result = readdir(dirp)) != NULL)
|
||||||
{
|
{
|
||||||
if (!result)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if ( virtio_check_filename (result->d_name) )
|
if ( virtio_check_filename (result->d_name) )
|
||||||
{
|
{
|
||||||
if ( get_instInv_ptr()->get_inst ( virtio_instance_name (result->d_name).data()) == NULL )
|
if ( get_instInv_ptr()->get_inst ( virtio_instance_name (result->d_name).data()) == NULL )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user