aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2015-11-22 21:50:28 -0500
committerLibravatar netblue30 <netblue30@yahoo.com>2015-11-22 21:50:28 -0500
commit1cb3f220153b733e9fe86fc0b5ed6d7dbe27670b (patch)
treeec8782a9924ee48266b58e342d3c11dcc971d528 /src
parentfeature testing (diff)
downloadfirejail-1cb3f220153b733e9fe86fc0b5ed6d7dbe27670b.tar.gz
firejail-1cb3f220153b733e9fe86fc0b5ed6d7dbe27670b.tar.zst
firejail-1cb3f220153b733e9fe86fc0b5ed6d7dbe27670b.zip
feature testing
Diffstat (limited to 'src')
-rw-r--r--src/firejail/fs_hostname.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/firejail/fs_hostname.c b/src/firejail/fs_hostname.c
index 94251df57..5a79526b6 100644
--- a/src/firejail/fs_hostname.c
+++ b/src/firejail/fs_hostname.c
@@ -71,6 +71,7 @@ void fs_hostname(const char *hostname) {
71 } 71 }
72 72
73 char buf[4096]; 73 char buf[4096];
74 int done = 0;
74 while (fgets(buf, sizeof(buf), fp1)) { 75 while (fgets(buf, sizeof(buf), fp1)) {
75 // remove '\n' 76 // remove '\n'
76 char *ptr = strchr(buf, '\n'); 77 char *ptr = strchr(buf, '\n');
@@ -78,8 +79,10 @@ void fs_hostname(const char *hostname) {
78 *ptr = '\0'; 79 *ptr = '\0';
79 80
80 // copy line 81 // copy line
81 if (strstr(buf, "127.0.0.1")) 82 if (strstr(buf, "127.0.0.1") && done == 0) {
83 done = 1;
82 fprintf(fp2, "%s %s\n", buf, hostname); 84 fprintf(fp2, "%s %s\n", buf, hostname);
85 }
83 else 86 else
84 fprintf(fp2, "%s\n", buf); 87 fprintf(fp2, "%s\n", buf);
85 } 88 }