On Tue, Jun 09, 2015 at 01:26:42PM +0200, Patrik Jakobsson wrote: [...] > +static int drm_get_driver_name(struct tcb *tcp, char *name, size_t bufsize) > +{ > + char path[PATH_MAX]; > + char link[PATH_MAX]; > + int ret; > + > + ret = getfdpath(tcp, tcp->u_arg[0], path, PATH_MAX - 1); > + if (!ret) > + return ret; The return code of getfdpath() is essentially the return code of readlink(), so the check should be the same as after readlink() below. > + > + snprintf(link, PATH_MAX, "/sys/class/drm/%s/device/driver", > + basename(path)); > + > + ret = readlink(link, path, PATH_MAX - 1); > + if (ret < 0) > + return ret; > + > + path[ret] = '\0'; > + strncpy(name, basename(path), bufsize); > + > + return 0; > +} -- ldv
Attachment:
pgpSC8OQBVhTN.pgp
Description: PGP signature
_______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx