aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/firecfg/firecfg.config10
-rw-r--r--src/firejail/util.c29
2 files changed, 29 insertions, 10 deletions
diff --git a/src/firecfg/firecfg.config b/src/firecfg/firecfg.config
index 4cfbb5480..e9ecab925 100644
--- a/src/firecfg/firecfg.config
+++ b/src/firecfg/firecfg.config
@@ -111,6 +111,7 @@ calligrawords
111cameramonitor 111cameramonitor
112cantata 112cantata
113catfish 113catfish
114cawbird
114celluloid 115celluloid
115checkbashisms 116checkbashisms
116cheese 117cheese
@@ -136,6 +137,7 @@ code
136code-oss 137code-oss
137com.github.dahenson.agenda 138com.github.dahenson.agenda
138com.github.johnfactotum.Foliate 139com.github.johnfactotum.Foliate
140com.gitlab.newsflash
139conkeror 141conkeror
140conky 142conky
141conplay 143conplay
@@ -238,6 +240,7 @@ freemind
238freeoffice-planmaker 240freeoffice-planmaker
239freeoffice-presentations 241freeoffice-presentations
240freeoffice-textmaker 242freeoffice-textmaker
243freetube
241freshclam 244freshclam
242frogatto 245frogatto
243frozen-bubble 246frozen-bubble
@@ -333,6 +336,7 @@ hedgewars
333hexchat 336hexchat
334highlight 337highlight
335hitori 338hitori
339homebank
336host 340host
337hugin 341hugin
338hyperrogue 342hyperrogue
@@ -436,6 +440,7 @@ mate-calculator
436mate-color-select 440mate-color-select
437mate-dictionary 441mate-dictionary
438mathematica 442mathematica
443mattermost-desktop
439mcabber 444mcabber
440mediainfo 445mediainfo
441mediathekview 446mediathekview
@@ -448,6 +453,7 @@ meteo-qt
448midori 453midori
449min 454min
450mindless 455mindless
456minecraft-launcher
451minetest 457minetest
452mirrormagic 458mirrormagic
453mocp 459mocp
@@ -502,6 +508,7 @@ neverball
502neverputt 508neverputt
503newsbeuter 509newsbeuter
504newsboat 510newsboat
511newsflash
505nheko 512nheko
506nicotine 513nicotine
507nitroshare 514nitroshare
@@ -536,7 +543,7 @@ orage
536ostrichriders 543ostrichriders
537out123 544out123
538palemoon 545palemoon
539pandoc 546#pandoc
540parole 547parole
541patch 548patch
542pavucontrol 549pavucontrol
@@ -778,6 +785,7 @@ xfburn
778xfce4-dict 785xfce4-dict
779xfce4-mixer 786xfce4-mixer
780xfce4-notes 787xfce4-notes
788xfce4-screenshooter
781xiphos 789xiphos
782xlinks 790xlinks
783xmms 791xmms
diff --git a/src/firejail/util.c b/src/firejail/util.c
index 6bfc80903..3aa0584d6 100644
--- a/src/firejail/util.c
+++ b/src/firejail/util.c
@@ -957,16 +957,27 @@ int remove_overlay_directory(void) {
957 return 0; 957 return 0;
958} 958}
959 959
960// flush stdin if it is connected to a tty and has input
960void flush_stdin(void) { 961void flush_stdin(void) {
961 if (isatty(STDIN_FILENO)) { 962 if (!isatty(STDIN_FILENO))
962 int cnt = 0; 963 return;
963 int rv = ioctl(STDIN_FILENO, FIONREAD, &cnt); 964
964 if (rv == 0 && cnt) { 965 int cnt = 0;
965 fwarning("removing %d bytes from stdin\n", cnt); 966 int rv = ioctl(STDIN_FILENO, FIONREAD, &cnt);
966 rv = ioctl(STDIN_FILENO, TCFLSH, TCIFLUSH); 967 if (rv != 0 || cnt == 0)
967 (void) rv; 968 return;
968 } 969
969 } 970 fwarning("removing %d bytes from stdin\n", cnt);
971
972 // If this process is backgrounded, below ioctl() will trigger
973 // SIGTTOU and stop us. We avoid this by ignoring SIGTTOU for
974 // the duration of the ioctl.
975 sighandler_t hdlr = signal(SIGTTOU, SIG_IGN);
976 rv = ioctl(STDIN_FILENO, TCFLSH, TCIFLUSH);
977 signal(SIGTTOU, hdlr);
978
979 if (rv)
980 fwarning("Flushing stdin failed: %s\n", strerror(errno));
970} 981}
971 982
972// return 1 if new directory was created, else return 0 983// return 1 if new directory was created, else return 0