ACPI / PNP: Avoid conflicting resource reservations
[linux/fpc-iii.git] / tools / usb / usbip / libsrc / sysfs_utils.c
blob36ac88ece0b87b2a1dd641f1fc3dbc13ecf8be33
1 #include <sys/types.h>
2 #include <sys/stat.h>
3 #include <fcntl.h>
4 #include <errno.h>
6 #include "sysfs_utils.h"
7 #include "usbip_common.h"
9 int write_sysfs_attribute(const char *attr_path, const char *new_value,
10 size_t len)
12 int fd;
13 int length;
15 fd = open(attr_path, O_WRONLY);
16 if (fd < 0) {
17 dbg("error opening attribute %s", attr_path);
18 return -1;
21 length = write(fd, new_value, len);
22 if (length < 0) {
23 dbg("error writing to attribute %s", attr_path);
24 close(fd);
25 return -1;
28 close(fd);
30 return 0;