Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

gav (2710)

gav
  (email not shown publicly)
http://www.estey.com/
AOL IM: flufflegavin (Add Buddy, Send Message)

Hacker in NYC.

Journal of gav (2710)

Monday May 17, 2004
10:05 AM

Scary code of the day

[ #18791 ]

sub lock_retrieveFH {
    my $datafile = sprintf ("/usr/bin/unzip -p %s |", FILE);
    open my $pipe, $datafile or die print $!, $/;
    flock($pipe,LOCK_EX);
    return $pipe;
}

*shudder*

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Do we want to make a list?

    1) What is FILE supposed to stringify to? It looks like a filehandle, but that won't give the filename. I'll be generous and assume we have "use constant FILE=>'filename.zip'" in there somewhere.

    2) Even assuming FILE stringifies, why sprintf?

    3) Locking a pipe? No other process can compete for access. Mistaken attempt to lock the underlying file, or very strange attempt at inter-thread locking?

    I really don't want to see the rest of that code.