Am 10.10.2012 13:32, schrieb Paolo Bonzini:
Fixes the following error with glibc 2.16 on Fedora 18:
virtfs-proxy-helper.c: In function ‘setfsugid’:
virtfs-proxy-helper.c:293:13: error: ignoring return value of ‘setfsgid’,
declared with attribute warn_unused_result [-Werror=unused-result]
virtfs-proxy-helper.c:294:13: error: ignoring return value of ‘setfsuid’,
declared with attribute warn_unused_result [-Werror=unused-result]
cc1: all warnings being treated as errors
Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
---
fsdev/virtfs-proxy-helper.c | 8 ++++++--
1 file modificato, 6 inserzioni(+), 2 rimozioni(-)
diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
index f9a8270..b34a84a 100644
--- a/fsdev/virtfs-proxy-helper.c
+++ b/fsdev/virtfs-proxy-helper.c
@@ -290,8 +290,12 @@ static int setfsugid(int uid, int gid)
CAP_DAC_OVERRIDE,
};
- setfsgid(gid);
- setfsuid(uid);
+ if (setfsgid(gid) != 0) {
+ return -1;
+ }
Wouldn't setfsgid(gid) == gid be also ok?
I have no idea whether it is a realistic scenario to call
that function with a gid which is already set.
+ if (setfsuid(uid) != 0) {
+ return -1;
+ }
The same question applies here.
if (uid != 0 || gid != 0) {
return do_cap_set(cap_list, ARRAY_SIZE(cap_list), 0);
The Linux manpage for both functions says something
completely different. Extract from manpage of setfsuid:
"On success, the previous value of fsuid is returned.
On error, the current value of fsuid is returned."
In reality, the functions return 0 when called by root.
Regards
Stefan