Codebase list kali-menu / 1c9c511
Put the PID in /var/lock/kali-menu so that we can more easily wait for the process to end. And empty the file upon completion. Raphaël Hertzog 8 years ago
2 changed file(s) with 14 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
0 kali-menu (2015.3.0) kali-dev; urgency=medium
1
2 * Put the PID in /var/lock/kali-menu so that we can more easily wait for
3 the process to end. And empty the file upon completion.
4
5 -- Raphaël Hertzog <[email protected]> Fri, 20 Nov 2015 17:00:43 +0100
6
07 kali-menu (3.3) kali-dev; urgency=medium
18
29 * Add sparta and commix icons
5959 release_desktop_file($out_file);
6060 }
6161
62 close($lock);
62 $lock->truncate(0);
63 $lock->close();
6364
6465 ### HELPER FUNCTIONS
6566
177178 sub get_lock {
178179 my $lockfile = KALI_MENU_LOCKFILE;
179180 system("mkdir -p /run/lock /var/lock; touch $lockfile") unless -e $lockfile;
180 open my $fh, '>>', $lockfile or syserr("Can't open %s", $lockfile);
181 open my $fh, '+<', $lockfile or syserr("Can't open %s", $lockfile);
181182 my $fs = new File::FcntlLock l_type => F_WRLCK;
182183 if (not $fs->lock($fh, F_SETLK)) {
183184 exit 0; # Failed to lock, another instance is already running
184185 }
186 $fh->truncate(0);
187 $fh->print("$$\n");
188 $fh->flush();
189 $fh->sync();
185190 return $fh;
186191 }
187192