Skip to contentSkip to conversation

virtfs-proxy: fix build with F18

PATCH In review Michael S. Tsirkin 3 participants 3 messages Feb 28, 2013 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtfs-proxy: fix build with F18

Ignoring return value of setfsgid(gid) and setfsuid(uid) causes warnings on F18. Check the return value: man page says glibc returns -1 on error.

---
 fsdev/virtfs-proxy-helper.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
fsdev/virtfs-proxy-helper.c +5 -2
index f9a8270..2f0d2b3 100644
@@ -282,6 +282,7 @@ static int send_status(int sockfd, struct iovec *iovec, int status)
  */
 static int setfsugid(int uid, int gid)
 {
+    int ret;
     /*
      * We still need DAC_OVERRIDE because  we don't change
      * supplementary group ids, and hence may be subjected DAC rules
@@ -290,8 +291,10 @@ static int setfsugid(int uid, int gid)
         CAP_DAC_OVERRIDE,
     };
 
-    setfsgid(gid);
-    setfsuid(uid);
+    ret = setfsgid(gid);
+    assert(ret != -1);
+    ret = setfsuid(uid);
+    assert(ret != -1);
 
     if (uid != 0 || gid != 0) {
         return do_cap_set(cap_list, ARRAY_SIZE(cap_list), 0);
Signature · 1 line
MST
#1 lore raw
Quoted 36 lines · Michael S. Tsirkin

Ignoring return value of setfsgid(gid) and setfsuid(uid) causes warnings on F18. Check the return value: man page says glibc returns -1 on error.

---
 fsdev/virtfs-proxy-helper.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
fsdev/virtfs-proxy-helper.c +5 -2
index f9a8270..2f0d2b3 100644
@@ -282,6 +282,7 @@ static int send_status(int sockfd, struct iovec *iovec, int status)
  */
 static int setfsugid(int uid, int gid)
 {
+    int ret;
     /*
      * We still need DAC_OVERRIDE because  we don't change
      * supplementary group ids, and hence may be subjected DAC rules
@@ -290,8 +291,10 @@ static int setfsugid(int uid, int gid)
         CAP_DAC_OVERRIDE,
     };
 
-    setfsgid(gid);
-    setfsuid(uid);
+    ret = setfsgid(gid);
+    assert(ret != -1);
+    ret = setfsuid(uid);
+    assert(ret != -1);
 
     if (uid != 0 || gid != 0) {
         return do_cap_set(cap_list, ARRAY_SIZE(cap_list), 0);
Signature · 1 line
MST

This got fixed upstream.

http://git.qemu.org/?p=qemu.git;a=commitdiff;h=9fd2ecdc8cb2dc1a8a7c57b6c9c60bc9947b6a73

-aneesh

#2 lore raw
In reply to Michael S. Tsirkin
Quoted 4 lines · Michael S. Tsirkin

Ignoring return value of setfsgid(gid) and setfsuid(uid) causes warnings on F18. Check the return value: man page says glibc returns -1 on error.

qemu-kvm is no more. It has ceased to be. Not sure what do you want me to do with the patch.

Quoted 32 lines
---
 fsdev/virtfs-proxy-helper.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
fsdev/virtfs-proxy-helper.c +5 -2
index f9a8270..2f0d2b3 100644
@@ -282,6 +282,7 @@ static int send_status(int sockfd, struct iovec *iovec, int status)
  */
 static int setfsugid(int uid, int gid)
 {
+    int ret;
     /*
      * We still need DAC_OVERRIDE because  we don't change
      * supplementary group ids, and hence may be subjected DAC rules
@@ -290,8 +291,10 @@ static int setfsugid(int uid, int gid)
         CAP_DAC_OVERRIDE,
     };
 
-    setfsgid(gid);
-    setfsuid(uid);
+    ret = setfsgid(gid);
+    assert(ret != -1);
+    ret = setfsuid(uid);
+    assert(ret != -1);
 
     if (uid != 0 || gid != 0) {
         return do_cap_set(cap_list, ARRAY_SIZE(cap_list), 0);
Signature · 1 line
MST

--
Gleb.