[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-zile] [PATCH] Check `fchmod' and `fchown' return value.
From: |
Giuseppe Scrivano |
Subject: |
[Bug-zile] [PATCH] Check `fchmod' and `fchown' return value. |
Date: |
Tue, 02 Mar 2010 21:33:50 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.92 (gnu/linux) |
This patch fixes the following compiler warning:
warning: ignoring return value of 'fchown', declared with attribute
warn_unused_result
Cheers,
Giuseppe
>From 33a48ed030e499b4619c4abeca32e755fb045203 Mon Sep 17 00:00:00 2001
From: Giuseppe Scrivano <address@hidden>
Date: Tue, 2 Mar 2010 21:12:32 +0100
Subject: [PATCH] Check `fchmod' and `fchown' return value.
---
src/file.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/file.c b/src/file.c
index 01184d2..42ed5a7 100644
--- a/src/file.c
+++ b/src/file.c
@@ -1,6 +1,6 @@
/* Disk file handling
- Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
2007, 2008, 2009 Free Software Foundation, Inc.
+ Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
2007, 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of GNU Zile.
@@ -698,9 +698,21 @@ copy_file (const char *source, const char *dest)
if (stat_valid)
{
#ifdef HAVE_FCHMOD
- fchmod (ofd, st.st_mode);
+ if (fchmod (ofd, st.st_mode))
+ {
+ minibuf_error ("Unable to change file `%s' permissions", dest);
+ close (ifd);
+ close (ofd);
+ return false;
+ }
#endif
- fchown (ofd, st.st_uid, st.st_gid);
+ if (fchown (ofd, st.st_uid, st.st_gid))
+ {
+ minibuf_error ("Unable to change file `%s' owner", dest);
+ close (ifd);
+ close (ofd);
+ return false;
+ }
}
close (ifd);
--
1.7.0
- [Bug-zile] [PATCH] Check `fchmod' and `fchown' return value.,
Giuseppe Scrivano <=