diff options
author | 1997-11-09 04:05:33 +0000 | |
---|---|---|
committer | 1997-11-09 04:05:33 +0000 | |
commit | ef993c808c625dbbc6f265560180069a9cf2b659 (patch) | |
tree | afef4368c3ced410c3b2166d70837f21064caf6e /lib/libutil | |
parent | Upgrade to sendmail 8.8.8 (diff) | |
download | wireguard-openbsd-ef993c808c625dbbc6f265560180069a9cf2b659.tar.xz wireguard-openbsd-ef993c808c625dbbc6f265560180069a9cf2b659.zip |
Correct the ftruncate() call.
Diffstat (limited to 'lib/libutil')
-rw-r--r-- | lib/libutil/uucplock.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/libutil/uucplock.c b/lib/libutil/uucplock.c index 5f879df8290..e75424f36d0 100644 --- a/lib/libutil/uucplock.c +++ b/lib/libutil/uucplock.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: uucplock.c,v 1.1 1997/11/09 00:29:15 bri Exp $ + * $Id: uucplock.c,v 1.2 1997/11/09 04:05:33 bri Exp $ * */ @@ -187,7 +187,13 @@ put_pid(fd, pid) int len; len = sprintf (buf, "%10d\n", pid); - return write (fd, buf, len) == len && ftruncate(fd, len); + + if (write (fd, buf, len) == len) { + /* We don't mind too much if ftruncate() fails - see get_pid */ + ftruncate(fd, len); + return 1; + } + return 0; } static pid_t |