aboutsummaryrefslogtreecommitdiffstats
path: root/src/firejail/appimage.c
diff options
context:
space:
mode:
authorLibravatar Fred Barclay <Fred-Barclay@users.noreply.github.com>2017-05-24 14:13:52 -0500
committerLibravatar Fred Barclay <Fred-Barclay@users.noreply.github.com>2017-05-24 14:13:52 -0500
commit96c920e166b40bbe50f216e294f2efac154a1cb2 (patch)
treefa80a34e81863ab897f2f2b8ec4124b10d023516 /src/firejail/appimage.c
parentremove trailing whitespace from etc/ (diff)
downloadfirejail-96c920e166b40bbe50f216e294f2efac154a1cb2.tar.gz
firejail-96c920e166b40bbe50f216e294f2efac154a1cb2.tar.zst
firejail-96c920e166b40bbe50f216e294f2efac154a1cb2.zip
Remove trailing whitespace from src/
Diffstat (limited to 'src/firejail/appimage.c')
-rw-r--r--src/firejail/appimage.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/firejail/appimage.c b/src/firejail/appimage.c
index e14de3c27..976750f8f 100644
--- a/src/firejail/appimage.c
+++ b/src/firejail/appimage.c
@@ -28,7 +28,7 @@
28#include <linux/loop.h> 28#include <linux/loop.h>
29#include <errno.h> 29#include <errno.h>
30 30
31static char *devloop = NULL; // device file 31static char *devloop = NULL; // device file
32static char *mntdir = NULL; // mount point in /tmp directory 32static char *mntdir = NULL; // mount point in /tmp directory
33 33
34static void err_loop(void) { 34static void err_loop(void) {
@@ -40,7 +40,7 @@ void appimage_set(const char *appimage) {
40 assert(appimage); 40 assert(appimage);
41 assert(devloop == NULL); // don't call this twice! 41 assert(devloop == NULL); // don't call this twice!
42 EUID_ASSERT(); 42 EUID_ASSERT();
43 43
44#ifdef LOOP_CTL_GET_FREE // test for older kernels; this definition is found in /usr/include/linux/loop.h 44#ifdef LOOP_CTL_GET_FREE // test for older kernels; this definition is found in /usr/include/linux/loop.h
45 // check appimage file 45 // check appimage file
46 invalid_filename(appimage); 46 invalid_filename(appimage);
@@ -74,13 +74,13 @@ void appimage_set(const char *appimage) {
74 close(cfd); 74 close(cfd);
75 if (asprintf(&devloop, "/dev/loop%d", devnr) == -1) 75 if (asprintf(&devloop, "/dev/loop%d", devnr) == -1)
76 errExit("asprintf"); 76 errExit("asprintf");
77 77
78 int lfd = open(devloop, O_RDONLY); 78 int lfd = open(devloop, O_RDONLY);
79 if (lfd == -1) 79 if (lfd == -1)
80 err_loop(); 80 err_loop();
81 if (ioctl(lfd, LOOP_SET_FD, ffd) == -1) 81 if (ioctl(lfd, LOOP_SET_FD, ffd) == -1)
82 err_loop(); 82 err_loop();
83 83
84 if (size) { 84 if (size) {
85 struct loop_info64 info; 85 struct loop_info64 info;
86 memset(&info, 0, sizeof(struct loop_info64)); 86 memset(&info, 0, sizeof(struct loop_info64));
@@ -88,7 +88,7 @@ void appimage_set(const char *appimage) {
88 if (ioctl(lfd, LOOP_SET_STATUS64, &info) == -1) 88 if (ioctl(lfd, LOOP_SET_STATUS64, &info) == -1)
89 err_loop(); 89 err_loop();
90 } 90 }
91 91
92 close(lfd); 92 close(lfd);
93 close(ffd); 93 close(ffd);
94 EUID_USER(); 94 EUID_USER();
@@ -99,13 +99,13 @@ void appimage_set(const char *appimage) {
99 EUID_ROOT(); 99 EUID_ROOT();
100 mkdir_attr(mntdir, 0700, getuid(), getgid()); 100 mkdir_attr(mntdir, 0700, getuid(), getgid());
101 EUID_USER(); 101 EUID_USER();
102 102
103 // mount 103 // mount
104 char *mode; 104 char *mode;
105 if (asprintf(&mode, "mode=700,uid=%d,gid=%d", getuid(), getgid()) == -1) 105 if (asprintf(&mode, "mode=700,uid=%d,gid=%d", getuid(), getgid()) == -1)
106 errExit("asprintf"); 106 errExit("asprintf");
107 EUID_ROOT(); 107 EUID_ROOT();
108 108
109 if (size == 0) { 109 if (size == 0) {
110 if (mount(devloop, mntdir, "iso9660",MS_MGC_VAL|MS_RDONLY, mode) < 0) 110 if (mount(devloop, mntdir, "iso9660",MS_MGC_VAL|MS_RDONLY, mode) < 0)
111 errExit("mounting appimage"); 111 errExit("mounting appimage");
@@ -128,7 +128,7 @@ void appimage_set(const char *appimage) {
128 // build new command line 128 // build new command line
129 if (asprintf(&cfg.command_line, "%s/AppRun", mntdir) == -1) 129 if (asprintf(&cfg.command_line, "%s/AppRun", mntdir) == -1)
130 errExit("asprintf"); 130 errExit("asprintf");
131 131
132 free(mode); 132 free(mode);
133#ifdef HAVE_GCOV 133#ifdef HAVE_GCOV
134 __gcov_flush(); 134 __gcov_flush();
@@ -151,7 +151,7 @@ void appimage_clear(void) {
151 if (rv == 0) { 151 if (rv == 0) {
152 if (!arg_quiet) 152 if (!arg_quiet)
153 printf("AppImage unmounted\n"); 153 printf("AppImage unmounted\n");
154 154
155 break; 155 break;
156 } 156 }
157 if (rv == -1 && errno == EBUSY) { 157 if (rv == -1 && errno == EBUSY) {
@@ -159,14 +159,14 @@ void appimage_clear(void) {
159 sleep(2); 159 sleep(2);
160 continue; 160 continue;
161 } 161 }
162 162
163 // rv = -1 163 // rv = -1
164 if (!arg_quiet) { 164 if (!arg_quiet) {
165 fwarning("error trying to unmount %s\n", mntdir); 165 fwarning("error trying to unmount %s\n", mntdir);
166 perror("umount"); 166 perror("umount");
167 } 167 }
168 } 168 }
169 169
170 if (rv == 0) { 170 if (rv == 0) {
171 rmdir(mntdir); 171 rmdir(mntdir);
172 free(mntdir); 172 free(mntdir);