On Wed, Jan 30, 2019 at 1:50 PM Christophe Fergeau <cfergeau@xxxxxxxxxx> wrote: > > vdagent.c has a 'file_test' function which tests for the existence of > the /dev entry for the spicevmc channel. glib already provides such a > g_file_test() function, so we can use it instead. > > Signed-off-by: Christophe Fergeau <cfergeau@xxxxxxxxxx> > --- > src/vdagent/vdagent.c | 11 +---------- > 1 file changed, 1 insertion(+), 10 deletions(-) > > diff --git a/src/vdagent/vdagent.c b/src/vdagent/vdagent.c > index ff3328c..adb56c4 100644 > --- a/src/vdagent/vdagent.c > +++ b/src/vdagent/vdagent.c > @@ -28,8 +28,6 @@ > #include <fcntl.h> > #include <errno.h> > #include <signal.h> > -#include <sys/select.h> > -#include <sys/stat.h> > #include <spice/vd_agent.h> > #include <poll.h> > #include <glib-unix.h> > @@ -319,13 +317,6 @@ static int daemonize(void) > return 0; > } > > -static int file_test(const char *path) > -{ > - struct stat buffer; > - > - return stat(path, &buffer); > -} > - > static gboolean x11_io_channel_cb(GIOChannel *source, > GIOCondition condition, > gpointer data) > @@ -450,7 +441,7 @@ int main(int argc, char *argv[]) > openlog("spice-vdagent", do_daemonize ? LOG_PID : (LOG_PID | LOG_PERROR), > LOG_USER); > > - if (file_test(portdev) != 0) { > + if (!g_file_test(portdev, G_FILE_TEST_EXISTS)) { > g_debug("vdagent virtio channel %s does not exist, exiting", portdev); > return 0; > } > -- Acked-by: Jakub Janků <jjanku@xxxxxxxxxx> > 2.20.1 > > _______________________________________________ > Spice-devel mailing list > Spice-devel@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/spice-devel _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel