]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
tools: only check for O_RDONLY 1379/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 4 Jan 2017 15:28:50 +0000 (16:28 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 4 Jan 2017 15:28:50 +0000 (16:28 +0100)
On some Android systems the lxc folders where containers are stored might be
read-only and so checking for O_RDWR, will effectively make the tools useless
on these systems, so let's dumb the check down to O_RDONLY.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/tools/lxc_attach.c
src/lxc/tools/lxc_copy.c
src/lxc/tools/lxc_create.c
src/lxc/tools/lxc_snapshot.c
src/lxc/tools/lxc_start.c

index 4dd38839ad3489477bfe232fea3c6d6f0db44e63..01e505a5315cd4d00ae3e83b3fb5f7647265ff9c 100644 (file)
@@ -395,7 +395,7 @@ int main(int argc, char *argv[])
        lxc_log_options_no_override();
 
        if (geteuid()) {
-               if (access(my_args.lxcpath[0], O_RDWR) < 0) {
+               if (access(my_args.lxcpath[0], O_RDONLY) < 0) {
                        if (!my_args.quiet)
                                fprintf(stderr, "You lack access to %s\n", my_args.lxcpath[0]);
                        exit(EXIT_FAILURE);
index 4d0c17df7117213762c11026f810406644c1687c..0627a6272bbefbabd418c46351ec9f2a0072d5ee 100644 (file)
@@ -184,7 +184,7 @@ int main(int argc, char *argv[])
        lxc_log_options_no_override();
 
        if (geteuid()) {
-               if (access(my_args.lxcpath[0], O_RDWR) < 0) {
+               if (access(my_args.lxcpath[0], O_RDONLY) < 0) {
                        if (!my_args.quiet)
                                fprintf(stderr, "You lack access to %s\n", my_args.lxcpath[0]);
                        exit(ret);
index 6e8acf002d070c521ce84ab3b071dc9c1145dad0..b8795c4462a4ad388c5ce6914d90b5b701df3db0 100644 (file)
@@ -252,7 +252,7 @@ int main(int argc, char *argv[])
                if (mkdir_p(my_args.lxcpath[0], 0755)) {
                        exit(EXIT_FAILURE);
                }
-               if (access(my_args.lxcpath[0], O_RDWR) < 0) {
+               if (access(my_args.lxcpath[0], O_RDONLY) < 0) {
                        fprintf(stderr, "You lack access to %s\n", my_args.lxcpath[0]);
                        exit(EXIT_FAILURE);
                }
index 1a79a7a1dcda7e70a76b45b17e94df3c3ef5e6bf..6948d19889e77a4fed68f435263c22a4056f6a48 100644 (file)
@@ -95,7 +95,7 @@ int main(int argc, char *argv[])
        lxc_log_options_no_override();
 
        if (geteuid()) {
-               if (access(my_args.lxcpath[0], O_RDWR) < 0) {
+               if (access(my_args.lxcpath[0], O_RDONLY) < 0) {
                        fprintf(stderr, "You lack access to %s\n",
                                my_args.lxcpath[0]);
                        exit(EXIT_FAILURE);
index c85305b27316fec75af7ccfa7886175d656b7ade..f5aa24bceb349cbb02dc604bf0253f838f4969f0 100644 (file)
@@ -231,7 +231,7 @@ int main(int argc, char *argv[])
                exit(err);
        lxc_log_options_no_override();
 
-       if (access(my_args.lxcpath[0], O_RDWR) < 0) {
+       if (access(my_args.lxcpath[0], O_RDONLY) < 0) {
                if (!my_args.quiet)
                        fprintf(stderr, "You lack access to %s\n", my_args.lxcpath[0]);
                exit(err);