From fbabf0288a7d185712310b6748e93ed8beb9e71f Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sat, 7 Feb 2009 22:15:55 +0000 Subject: [PATCH 1/1] Do not fork out for touch(1) anymore Signed-off-by: Frank Lichtenheld --- bin/extract_files | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/extract_files b/bin/extract_files index 3bfc559..b5753b2 100755 --- a/bin/extract_files +++ b/bin/extract_files @@ -130,6 +130,13 @@ sub add_log { $$log .= localtime().": @_\n"; } +sub touch { + my $filename = shift; + sysopen(H, $filename, O_WRONLY|O_NONBLOCK|O_CREAT) or return undef; + close(H); + return 1; +} + ################################################## # PACKAGE HANDLING (UNPACKING/CLEANUP) @@ -228,7 +235,7 @@ sub to_update { if ($config_data->{structure} == PKGPOOL) { my $dir = "$target/".pkg_pool_directory( $pkg_data ); if (!$force && -d $dir && -f "$dir/log") { - (system( "touch", "$dir/log" ) == 0) + touch("$dir/log") or do_warning( "touch of $dir/log failed" ); return 0; } else { @@ -302,7 +309,7 @@ sub extract_copyright_to_pkgpool { or add_log( $log, "symlink generation failed" ); } else { add_log( $log, "give up on $bin_pkg" ); - (system( "touch", "$tgt.ERROR" ) == 0) + touch("$tgt.ERROR") or add_log( $log, "even the touch of $tgt.ERROR failed :(" ); } } @@ -327,7 +334,7 @@ sub extract_copyright_to_pkgpool { } unless (-e $src_tgt) { add_log( $log, "give up" ); - (system( "touch", "$src_tgt.ERROR" ) == 0) or + touch("$src_tgt.ERROR") or add_log( $log, "even the touch of $src_tgt.ERROR failed :(" ); } } -- 2.39.2