mirror of
https://github.com/nitanmarcel/isodrive.git
synced 2026-03-13 04:17:24 +00:00
util: report write errors in sysfs_write
This commit is contained in:
+10
-2
@@ -59,11 +59,19 @@ void sysfs_write(char *path, char *content)
|
|||||||
{
|
{
|
||||||
std::cout << "Write: " << content << " -> " << path << std::endl;
|
std::cout << "Write: " << content << " -> " << path << std::endl;
|
||||||
int fd;
|
int fd;
|
||||||
fd = open(path, O_WRONLY);
|
if (fd = open(path, O_WRONLY) == -1)
|
||||||
write(fd, content, strlen(content));
|
{
|
||||||
|
perror("Failed to open sysfs file");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (write(fd, content, strlen(content) == -1))
|
||||||
|
{
|
||||||
|
perror("Failed to write sysfs file");
|
||||||
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *getprop(char *key)
|
char *getprop(char *key)
|
||||||
{
|
{
|
||||||
std::array<char, 128> buffer;
|
std::array<char, 128> buffer;
|
||||||
|
|||||||
Reference in New Issue
Block a user