From 79b432d1676bbbbd5b584d3ca7e67a484b24e0c8 Mon Sep 17 00:00:00 2001 From: didg Date: Mon, 26 Jan 2009 10:34:31 +0000 Subject: [PATCH] savevoloptions: check ftruncate return code --- etc/afpd/volume.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/etc/afpd/volume.c b/etc/afpd/volume.c index 6b9b4213..8bd76a4d 100644 --- a/etc/afpd/volume.c +++ b/etc/afpd/volume.c @@ -1,5 +1,5 @@ /* - * $Id: volume.c,v 1.51.2.7.2.33.2.16 2009-01-13 01:05:53 didg Exp $ + * $Id: volume.c,v 1.51.2.7.2.33.2.17 2009-01-26 10:34:31 didg Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -2321,13 +2321,10 @@ static int savevoloptions (const struct vol *vol) LOG(log_debug, logtype_afpd,"Error writing .volinfo file: buffer too small, %s", buf); - if (write( fd, buf, strlen(buf)) < 0) { + if (write( fd, buf, strlen(buf)) < 0 || ftruncate(fd, strlen(buf)) < 0 ) { LOG(log_debug, logtype_afpd,"Error writing .volinfo file: %s", strerror(errno)); - goto done; } - ftruncate(fd, strlen(buf)); -done: lock.l_type = F_UNLCK; fcntl(fd, F_SETLK, &lock); close (fd); -- 2.39.2