X-Git-Url: https://git.gag.com/?a=blobdiff_plain;ds=sidebyside;f=common-src%2Famcryptsimple.pl;h=cf5306bf2b3698fc7784246c7005892bc9d049ae;hb=fd48f3e498442f0cbff5f3606c7c403d0566150e;hp=ef5b7d6052d699b415754819c608c92619b52fbf;hpb=96f35b20267e8b1a1c846d476f27fcd330e0b018;p=debian%2Famanda diff --git a/common-src/amcryptsimple.pl b/common-src/amcryptsimple.pl index ef5b7d6..cf5306b 100755 --- a/common-src/amcryptsimple.pl +++ b/common-src/amcryptsimple.pl @@ -1,6 +1,6 @@ #!@PERL@ -w # -# Copyright (c) 2005-2008 Zmanda Inc. All Rights Reserved. +# Copyright (c) 2007,2008 Zmanda, Inc. All Rights Reserved. # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License version 2 as published @@ -15,7 +15,7 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300 +# Contact information: Zmanda Inc, 465 S. Mathilda Ave., Suite 300 # Sunnyvale, CA 94086, USA, or: http://www.zmanda.com # @@ -56,10 +56,30 @@ $ENV{'GNUPGHOME'} = "$AMANDA_HOME/.gnupg"; sub encrypt() { system "gpg --batch --no-secmem-warning --disable-mdc --symmetric --cipher-algo AES256 --passphrase-fd 3 3<$AM_PASS"; + if ($? == -1) { + print STDERR "failed to execute gpg: $!\n"; + exit (1); + } elsif ($? & 127) { + printf STDERR "gpg died with signal %d\n", ($? & 127); + exit ($?); + } elsif ($? >> 8) { + printf STDERR "gpg exited with value %d\n", ($? >> 8); + exit ($? >> 8); + } } sub decrypt() { - system "gpg --batch --quiet --no-mdc-warning --decrypt --passphrase-fd 3 3<$AM_PASS"; + system "gpg --batch --quiet --no-mdc-warning --decrypt --passphrase-fd 3 3<$AM_PASS"; + if ($? == -1) { + print STDERR "failed to execute gpg: $!\n"; + exit (1); + } elsif ($? & 127) { + printf STDERR "gpg died with signal %d\n", ($? & 127); + exit ($?); + } elsif ($? >> 8) { + printf STDERR "gpg exited with value %d\n", ($? >> 8); + exit ($? >> 8); + } } sub int_catcher {