changeset 797:cdab6866a016

common: assert that xdrfd_create's buffer truncation worked There is currently no way to return if an error occurred, so let's simply assert for now. All the memory-backed buffers (i.e., heap and rw static) always succeed when truncating to zero size, so the intended use case will always succeed. Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Thu, 02 Apr 2020 20:59:43 -0400
parents b0ecf5a49e0c
children 68939d7b83f8
files src/common/xdrfd.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/common/xdrfd.c	Thu Apr 02 14:48:42 2020 -0400
+++ b/src/common/xdrfd.c	Thu Apr 02 20:59:43 2020 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2019 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * Copyright (c) 2015-2020 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -185,7 +185,7 @@
 void xdrfd_create(XDR *xdr, int fd, struct buffer *buf, enum xdr_op op)
 {
 	if (buf)
-		buffer_truncate(buf, 0);
+		VERIFY0(buffer_truncate(buf, 0));
 
 	xdr->x_op = op;
 	xdr->x_ops = (struct xdr_ops *) &ops;