Hello, attached is a simple patch for the curl tool, to ignore file size of special files when uploading. With the patch applied, it's possible to upload the content of a block device by passing the file directly to the -T option and curl does not return CURLE_PARTIAL_FILE. The other consequence is that curl honestly refuses to upload the content of a block device by SCP, instead of silently creating an empty file on server.
More details are available at https://bugzilla.redhat.com/622520 Any feedback welcome! Kamil
From 466f62402d3a4507e39cbe0896b25ac283051b49 Mon Sep 17 00:00:00 2001 From: Kamil Dudka <[email protected]> Date: Thu, 12 Aug 2010 21:45:31 +0200 Subject: [PATCH] curl -T: ignore file size of special files original bug report at https://bugzilla.redhat.com/622520 --- src/main.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/src/main.c b/src/main.c index 5585c17..3b78d60 100644 --- a/src/main.c +++ b/src/main.c @@ -4925,7 +4925,10 @@ operate(struct Configurable *config, int argc, argv_item_t argv[]) goto quit_urls; } infdopen=TRUE; - uploadfilesize=fileinfo.st_size; + + /* we ignore file size for char/block devices, sockets, etc. */ + if(S_IFREG == (fileinfo.st_mode & S_IFMT)) + uploadfilesize=fileinfo.st_size; } else if(uploadfile && stdin_upload(uploadfile)) { -- 1.7.2.1
------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
