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

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

 



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?

> +	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)
>  {

Robert
--
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