[4.0] ffa893e Squash further warn_unused_result warnings.

Lasse Karstensen lkarsten at varnish-software.com
Mon Sep 22 16:38:25 CEST 2014


commit ffa893e3c69df0ddf6b3f3cffdc35154e82b5ab4
Author: Lasse Karstensen <lkarsten at varnish-software.com>
Date:   Thu Sep 4 14:45:11 2014 +0200

    Squash further warn_unused_result warnings.
    
    Not being able to fchown() is normal when running varnishd
    unprivileged, so don't report failure unless running as root.

diff --git a/bin/varnishd/mgt/mgt_vcc.c b/bin/varnishd/mgt/mgt_vcc.c
index b76b016..35e3806 100644
--- a/bin/varnishd/mgt/mgt_vcc.c
+++ b/bin/varnishd/mgt/mgt_vcc.c
@@ -248,7 +248,10 @@ mgt_run_cc(const char *vcl, struct vsb *sb, int C_flag, unsigned *status)
 		*status = 2;
 		return (NULL);
 	}
-	(void)fchown(sfd, mgt_param.uid, mgt_param.gid);
+	if (fchown(sfd, mgt_param.uid, mgt_param.gid) != 0)
+		if (geteuid() == 0)
+			VSB_printf(sb, "Failed to change owner on %s: %s\n",
+			    sf, strerror(errno));
 	AZ(close(sfd));
 
 
@@ -286,7 +289,10 @@ mgt_run_cc(const char *vcl, struct vsb *sb, int C_flag, unsigned *status)
 		*status = 2;
 		return (NULL);
 	}
-	(void)fchown(i, mgt_param.uid, mgt_param.gid);
+	if (fchown(i, mgt_param.uid, mgt_param.gid) != 0)
+		if (geteuid() == 0)
+			VSB_printf(sb, "Failed to change owner on %s: %s\n",
+			    of, strerror(errno));
 	AZ(close(i));
 
 	/* Build the C-compiler command line */



More information about the varnish-commit mailing list