diff options
author | neeshy | 2020-01-28 23:06:44 -0500 |
---|---|---|
committer | neeshy | 2020-01-28 23:35:08 -0500 |
commit | e84b340920cfca2a9143c0701a613c2566e25132 (patch) | |
tree | 59953a296b989631b53af0ee0b1a03ffcf2cc966 /mem-suspend.c | |
parent | 6ab986ab9a50166b2e5196258fd14a660b30af92 (diff) | |
download | aur-e84b340920cfca2a9143c0701a613c2566e25132.tar.gz |
mem-suspend: use POSIX functions instead of C standard functions
Diffstat (limited to 'mem-suspend.c')
-rw-r--r-- | mem-suspend.c | 11 |
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; } |