[libvirt] [PATCH] build: fix build without posix_fallocate

Eric Blake eblake at redhat.com
Thu Jun 6 02:40:54 UTC 2013


On 06/05/2013 08:34 PM, Eric Blake wrote:
> Such as on FreeBSD.  Broken in commit aa2a4cff7
> 
> * src/util/virstoragefile.c (virStorageFileResize): Add missing ';'.
> 
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
> 
> Pushing under the build-breaker rule.
> 
>  src/util/virstoragefile.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
> index bf668c8..b861fd8 100644
> --- a/src/util/virstoragefile.c
> +++ b/src/util/virstoragefile.c
> @@ -1074,7 +1074,7 @@ virStorageFileResize(const char *path,
>          }
>  #else
>          virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
> -                       _("preallocate is not supported on this platform"))
> +                       _("preallocate is not supported on this platform"));
>          goto cleanup;
>  #endif
>      } else {
> 

Actually squashing this in first, to avoid the next failure of unused
variables.  Also, I really think we should ditch the code protected by:
 #elif HAVE_SYS_SYSCALL_H && defined(SYS_fallocate)
as it is extremely unlikely these days to have a kernel with fallocate
but a glibc that lacks the wrapper.  Anyone on a system that out-of-date
deserves to not be able to use this feature.

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index bf668c8..b985df4 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1048,9 +1048,12 @@ virStorageFileResize(const char *path,
 {
     int fd = -1;
     int ret = -1;
-    int rc;
-    off_t offset = orig_capacity;
-    off_t len = capacity - orig_capacity;
+    int rc ATTRIBUTE_UNUSED;
+    off_t offset ATTRIBUTE_UNUSED;
+    off_t len ATTRIBUTE_UNUSED;
+
+    offset = orig_capacity;
+    len = capacity - orig_capacity;

     if ((fd = open(path, O_RDWR)) < 0) {
         virReportSystemError(errno, _("Unable to open '%s'"), path);

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130605/a7bb8062/attachment-0001.sig>


More information about the libvir-list mailing list