/[psinib]/psinib.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /psinib.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by dpavlin, Sat Jan 4 11:42:56 2003 UTC revision 1.2 by dpavlin, Sat Jan 4 12:14:54 2003 UTC
# Line 21  use POSIX qw(strftime); Line 21  use POSIX qw(strftime);
21  use List::Compare;  use List::Compare;
22  use Filesys::SmbClient;  use Filesys::SmbClient;
23  #use Taint;  #use Taint;
24    use Fcntl qw(LOCK_EX LOCK_NB);
25    
26  # configuration  # configuration
27  my $LOG_TIME_FMT = '%Y-%m-%d %H:%M:%S'; # strftime format for logfile  my $LOG_TIME_FMT = '%Y-%m-%d %H:%M:%S'; # strftime format for logfile
# Line 39  my @ignore = ('.md5sum', '.backupignore' Line 40  my @ignore = ('.md5sum', '.backupignore'
40  open(L, "> $LOG") || die "can't open log $LOG: $!";  open(L, "> $LOG") || die "can't open log $LOG: $!";
41  select((select(L), $|=1)[0]);   # flush output  select((select(L), $|=1)[0]);   # flush output
42    
43    # make a lock on logfile
44    
45    my $c = 0;
46    {
47            flock L, LOCK_EX | LOCK_NB and last;
48            sleep 1;
49            redo if ++$c < 10;
50            # no response for 10 sec, bail out
51            print STDERR "can't take lock on $LOG -- another $0 running?\n";
52            exit 1;
53    }
54    
55  # taint path: nmblookup should be there!  # taint path: nmblookup should be there!
56  $ENV{'PATH'} = "/usr/bin:/bin";  $ENV{'PATH'} = "/usr/bin:/bin";
57    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.26