RE: [PATCH 1/6] libusbg: Add remove binding functionality.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

> -----Original Message-----
> From: Robert Baldyga [mailto:r.baldyga@xxxxxxxxxxx]
> Sent: Monday, March 10, 2014 10:43 AM
> To: Krzysztof Opasiak; mporter@xxxxxxxxxx; linux-
> usb@xxxxxxxxxxxxxxx
> Cc: Andrzej Pietrasiewicz; Karol Lewandowski; Stanislaw Wadas;
> ty317.kim@xxxxxxxxxxx; Marek Szyprowski
> Subject: Re: [PATCH 1/6] libusbg: Add remove binding functionality.
> 
> Hi,
> 
> > diff --git a/src/usbg.c b/src/usbg.c
> > index f655675..e82658c 100644
> > --- a/src/usbg.c
> > +++ b/src/usbg.c
> > @@ -142,6 +142,7 @@ static int usbg_translate_error(int error)
> >  		break;
> >  	case EACCES:
> >  	case EROFS:
> > +	case EPERM:
> >  		ret = USBG_ERROR_NO_ACCESS;
> >  		break;
> >  	case ENOENT:
> > @@ -450,6 +451,22 @@ static void usbg_free_state(usbg_state *s)
> >  	free(s);
> >  }
> >
> > +static int usbg_remove_file(char *path, char *name)
> > +{
> > +	int ret;
> > +	char buf[USBG_MAX_PATH_LENGTH];
> > +
> > +	sprintf(buf, "%s/%s", path, name);
> 
> Maybe snprintf would be better?

There is much more sprintf in library. All those functions will be
replaced with snprintf when removing satic buffers and handling
overflows. So it is future work in whole library

> 
> > +	ret = unlink(buf);
> > +	if (ret != 0)
> > +		ret = usbg_translate_error(errno);
> > +	else
> > +		ret = USBG_SUCCESS;
> > +
> > +	return ret;
> > +}
> > +
> >  static int usbg_parse_function_net_attrs(usbg_function *f,
> >  		usbg_function_attrs *f_attrs)
> >  {
> 

Krzysiek


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux