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
|
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 |
|
0 | 7 |
kali-menu (3.3) kali-dev; urgency=medium
|
1 | 8 |
|
2 | 9 |
* Add sparta and commix icons
|
59 | 59 |
release_desktop_file($out_file);
|
60 | 60 |
}
|
61 | 61 |
|
62 | |
close($lock);
|
|
62 |
$lock->truncate(0);
|
|
63 |
$lock->close();
|
63 | 64 |
|
64 | 65 |
### HELPER FUNCTIONS
|
65 | 66 |
|
|
177 | 178 |
sub get_lock {
|
178 | 179 |
my $lockfile = KALI_MENU_LOCKFILE;
|
179 | 180 |
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);
|
181 | 182 |
my $fs = new File::FcntlLock l_type => F_WRLCK;
|
182 | 183 |
if (not $fs->lock($fh, F_SETLK)) {
|
183 | 184 |
exit 0; # Failed to lock, another instance is already running
|
184 | 185 |
}
|
|
186 |
$fh->truncate(0);
|
|
187 |
$fh->print("$$\n");
|
|
188 |
$fh->flush();
|
|
189 |
$fh->sync();
|
185 | 190 |
return $fh;
|
186 | 191 |
}
|
187 | 192 |
|