mirror of
https://github.com/zhaojh329/rtty.git
synced 2026-02-27 09:53:17 +08:00
up/down file: notice must be run as root
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
This commit is contained in:
@@ -79,6 +79,11 @@ void download_file()
|
||||
static struct ev_signal sw;
|
||||
struct ev_io ior;
|
||||
|
||||
if (getuid() > 0) {
|
||||
fprintf(stderr, "Operation not permitted, must be run as root\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!realpath(".", abspath))
|
||||
return;
|
||||
|
||||
|
||||
@@ -73,6 +73,11 @@ void upload_file(const char *path)
|
||||
struct stat st;
|
||||
int fd;
|
||||
|
||||
if (getuid() > 0) {
|
||||
fprintf(stderr, "Operation not permitted, must be run as root\n");
|
||||
return;
|
||||
}
|
||||
|
||||
fd = open(path, O_RDONLY);
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "open '%s' failed: ", path);
|
||||
|
||||
Reference in New Issue
Block a user