vxlan: check return value of gro_cells_init()
[linux/fpc-iii.git] / tools / usb / usbip / libsrc / sysfs_utils.c
blob14d5e67d398a96bee5c0970d97f2d8ffa0d108a8
1 // SPDX-License-Identifier: GPL-2.0
2 #include <sys/types.h>
3 #include <sys/stat.h>
4 #include <fcntl.h>
5 #include <errno.h>
7 #include "sysfs_utils.h"
8 #include "usbip_common.h"
10 int write_sysfs_attribute(const char *attr_path, const char *new_value,
11 size_t len)
13 int fd;
14 int length;
16 fd = open(attr_path, O_WRONLY);
17 if (fd < 0) {
18 dbg("error opening attribute %s", attr_path);
19 return -1;
22 length = write(fd, new_value, len);
23 if (length < 0) {
24 dbg("error writing to attribute %s", attr_path);
25 close(fd);
26 return -1;
29 close(fd);
31 return 0;