X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Fbase64.c;h=215812af76a2fc63071145e0c86fb5a323260299;hb=34c0542189a443e57f2b09886f31b5bdad404bbf;hp=89bf4379d884535f5c755e178fdffc0463f54ef2;hpb=c3a68961859a617f7c574c528d0f8ac1fdbb53e1;p=libguestfs.git diff --git a/daemon/base64.c b/daemon/base64.c index 89bf437..215812a 100644 --- a/daemon/base64.c +++ b/daemon/base64.c @@ -13,7 +13,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include @@ -23,7 +23,7 @@ #include #include -#include "../src/guestfs_protocol.h" +#include "guestfs_protocol.h" #include "daemon.h" #include "actions.h" @@ -42,7 +42,7 @@ do_base64_in (const char *file) FILE *fp; char *cmd; - if (asprintf_nowarn (&cmd, "base64 -d > %R", file) == -1) { + if (asprintf_nowarn (&cmd, "base64 -d -i > %R", file) == -1) { err = errno; cancel_receive (); errno = err; @@ -77,14 +77,15 @@ do_base64_in (const char *file) return -1; } if (r == -2) { /* cancellation from library */ + /* This error is ignored by the library since it initiated the + * cancel. Nevertheless we must send an error reply here. + */ + reply_with_error ("file upload cancelled"); pclose (fp); - /* Do NOT send any error. */ return -1; } if (pclose (fp) != 0) { - if (r == -1) /* if r == 0, file transfer ended already */ - cancel_receive (); reply_with_error ("base64 subcommand failed on file: %s", file); return -1; }