summarylogtreecommitdiffstats
path: root/mem-suspend.c
diff options
context:
space:
mode:
Diffstat (limited to 'mem-suspend.c')
-rw-r--r--mem-suspend.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/mem-suspend.c b/mem-suspend.c
index 8e09e9fb6cd8..d7d18e97e4fb 100644
--- a/mem-suspend.c
+++ b/mem-suspend.c
@@ -1,20 +1,21 @@
-#include <stdlib.h>
#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
#include <errno.h>
static const char *state_path = "/sys/power/state";
int main(void)
{
- FILE *fp = fopen(state_path, "w");
- if (fp)
+ int fd = open(state_path, O_WRONLY | O_TRUNC);
+ if (fd != -1)
{
- fputs("mem", fp);
+ write(fd, "mem", 3);
}
else
{
perror(state_path);
return errno;
}
- return EXIT_SUCCESS;
+ return 0;
}