ia64/xen-unstable

changeset 9882:a8cac38001ca

When building with FORTIFY_SOURCE to ensure that return codes of common
functions are checked to avoid some bugs, a few warnings pop up and
become errors due to -Werror. Attached checks the return codes
(or at least stores them to a dummy variable).

Signed-off-by: Jeremy Katz <katzj@redhat.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Apr 28 14:08:40 2006 +0100 (2006-04-28)
parents dfdc32a9814f
children f06b6db6823d
files tools/xenstore/xenstored_core.c
line diff
     1.1 --- a/tools/xenstore/xenstored_core.c	Fri Apr 28 09:40:07 2006 +0100
     1.2 +++ b/tools/xenstore/xenstored_core.c	Fri Apr 28 14:08:40 2006 +0100
     1.3 @@ -173,7 +173,7 @@ void trace(const char *fmt, ...)
     1.4  	va_list arglist;
     1.5  	char *str;
     1.6  	char sbuf[1024];
     1.7 -	int ret;
     1.8 +	int ret, dummy;
     1.9  
    1.10  	if (tracefd < 0)
    1.11  		return;
    1.12 @@ -184,7 +184,7 @@ void trace(const char *fmt, ...)
    1.13  	va_end(arglist);
    1.14  
    1.15  	if (ret <= 1024) {
    1.16 -		write(tracefd, sbuf, ret);
    1.17 +		dummy = write(tracefd, sbuf, ret);
    1.18  		return;
    1.19  	}
    1.20  
    1.21 @@ -192,7 +192,7 @@ void trace(const char *fmt, ...)
    1.22  	va_start(arglist, fmt);
    1.23  	str = talloc_vasprintf(NULL, fmt, arglist);
    1.24  	va_end(arglist);
    1.25 -	write(tracefd, str, strlen(str));
    1.26 +	dummy = write(tracefd, str, strlen(str));
    1.27  	talloc_free(str);
    1.28  }
    1.29  
    1.30 @@ -238,7 +238,8 @@ void trace_destroy(const void *data, con
    1.31  static void trigger_reopen_log(int signal __attribute__((unused)))
    1.32  {
    1.33  	char c = 'A';
    1.34 -	write(reopen_log_pipe[1], &c, 1);
    1.35 +	int dummy;
    1.36 +	dummy = write(reopen_log_pipe[1], &c, 1);
    1.37  }
    1.38  
    1.39  
    1.40 @@ -1678,7 +1679,8 @@ static void write_pidfile(const char *pi
    1.41  		exit(0);
    1.42  
    1.43  	len = sprintf(buf, "%d\n", getpid());
    1.44 -	write(fd, buf, len);
    1.45 +	if (write(fd, buf, len) != len)
    1.46 +		barf_perror("Writing pid file %s", pidfile);
    1.47  }
    1.48  
    1.49  /* Stevens. */
    1.50 @@ -1703,7 +1705,8 @@ static void daemonize(void)
    1.51  
    1.52  #ifndef TESTING	/* Relative paths for socket names */
    1.53  	/* Move off any mount points we might be in. */
    1.54 -	chdir("/");
    1.55 +	if (chdir("/") == -1)
    1.56 +		barf_perror("Failed to chdir");
    1.57  #endif
    1.58  	/* Discard our parent's old-fashioned umask prejudices. */
    1.59  	umask(0);
    1.60 @@ -1900,7 +1903,8 @@ int main(int argc, char *argv[])
    1.61  
    1.62  		if (FD_ISSET(reopen_log_pipe[0], &inset)) {
    1.63  			char c;
    1.64 -			read(reopen_log_pipe[0], &c, 1);
    1.65 +			if (read(reopen_log_pipe[0], &c, 1) != 1)
    1.66 +				barf_perror("read failed");
    1.67  			reopen_log();
    1.68  		}
    1.69