| /* Common utmpx implementation |
| * Copyright 2015-2017 Rivoreo |
| * |
| * This program is free software; you can redistribute it and/or modify it |
| * under the terms of the GNU General Public License as published by the |
| * Free Software Foundation; either version 2 of the License, or (at your |
| * option) any later version. |
| * |
| * This program is distributed in the hope that it will be useful, but WITHOUT |
| * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| * more details. |
| */ |
| |
| #include "utmpx.h" |
| #include <unistd.h> |
| #include <fcntl.h> |
| |
| void updwtmpx(const char *wtmpx_file, const struct utmpx *utx) { |
| int fd = open(wtmpx_file, O_WRONLY | O_APPEND); |
| if(fd == -1) return; |
| write(fd, utx, sizeof *utx); |
| close(fd); |
| } |