view debian/patches/20_bins-syscall @ 6:3021deef1599

Encoding related fixes * chomp encoding string * reformat else (seems someone hacked it in) * debug print encoding * do not use :utf8 binmode ("re-encode") on written file if the input is _already_ UTF-8
author Peter Gervai <grin@grin.hu>
date Thu, 16 Oct 2008 00:02:14 +0200
parents c5749e43b1d7
children
line wrap: on
line source

#! /bin/sh /usr/share/dpatch/dpatch-run
## 20_bins-1.1.29-syscall.dpatch by  <rousseau@localhost.localdomain>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.

@DPATCH@
--- bins-1.1.29.orig/bins
+++ bins-1.1.29/bins
@@ -3546,13 +3546,14 @@
                     $newpath = "$picdir$origName";
                 }
                 beVerboseN("Linking from $albumdir$newName to $newpath... ", 2);
-                system("ln", "-sf", $newpath, "$albumdir$newName") == 0
+                unlink("$albumdir$newName");
+                symlink($newpath, "$albumdir$newName") == 1
                     or die("\nCannot link $albumdir$newName to $newpath: $?");
                 # the original file may be r/o but we don't have to modify it
                 # but it must be readable by the http deamon
                 if ($configHash->{updateOriginalPerms})
                 {
-                    system("chmod", "a+r", "$picdir$origName") == 0
+                    chmod(0644, "$picdir$origName") == 1
                         or die("\nCannot set read permission on $albumdir$newName: $?");
                 }
                 beVerboseN("done.", 2);
@@ -3563,7 +3564,7 @@
                 system("cp", "-p", "$picdir$origName", "$albumdir$newName") == 0
                     or die("\nCannot copy $picdir$origName to $albumdir$newName: $?");
                 # make it writable in case $origName was r/o
-                system("chmod", "u+w,a+r", "$albumdir$newName") == 0
+                chmod(0644, "$albumdir$newName") == 1
                     or die("\nCannot set write permission on $albumdir$newName: $?");
                 beVerboseN("done.", 2);
                 return 1;