diff --git a/src/downfile.c b/src/downfile.c index e499d8a..c3383df 100644 --- a/src/downfile.c +++ b/src/downfile.c @@ -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; diff --git a/src/upfile.c b/src/upfile.c index ddb45c4..cb8719a 100644 --- a/src/upfile.c +++ b/src/upfile.c @@ -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);