[pisa-src] r1823 - trunk/libpisa/util.c

  • From: Thomas Jansen <mithi@xxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Thu, 26 Nov 2009 16:40:05 +0100

Author: tjansen
Date: Thu Nov 26 16:40:05 2009
New Revision: 1823

Log:
Fixed warning introduced in 1819:

libpisa/util.c: In function ‘pisa_create_lock_file’:
libpisa/util.c:283: error: ignoring return value of ‘read’, declared with 
attribute warn_unused_result
libpisa/util.c:290: error: ignoring return value of ‘write’, declared with 
attribute warn_unused_result

Modified:
   trunk/libpisa/util.c

Modified: trunk/libpisa/util.c
==============================================================================
--- trunk/libpisa/util.c        Thu Nov 26 16:29:55 2009        (r1822)
+++ trunk/libpisa/util.c        Thu Nov 26 16:40:05 2009        (r1823)
@@ -271,7 +271,7 @@
 void pisa_create_lock_file(const char *filename)
 {
        char pid_str[8];
-       int fd, pid;
+       int fd, pid, len;
 
        if (!(fd = open(filename, O_RDWR | O_CREAT, 0644))) {
                PISA_ERROR("Can't open lock file.");
@@ -280,14 +280,14 @@
 
        if (lockf(fd, F_TLOCK, 0) < 0) {
                memset(pid_str, 0, sizeof(pid_str));
-               read(fd, pid_str, sizeof(pid_str) - 1);
+               len = read(fd, pid_str, sizeof(pid_str) - 1);
                pid = atoi(pid_str);
                PISA_ERROR("Another process is already running: PID %i.\n", 
pid);
                exit(2);
        }
 
        snprintf(pid_str, sizeof(pid_str), "%d\n", getpid());
-       write(fd, pid_str, strlen(pid_str));
+       len = write(fd, pid_str, strlen(pid_str));
 }
 
 /**

Other related posts:

  • » [pisa-src] r1823 - trunk/libpisa/util.c - Thomas Jansen