lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1568 - nss-pam-ldapd/nslcd

[Date Prev][Date Next] [Thread Prev][Thread Next]

nss-pam-ldapd commit: r1568 - nss-pam-ldapd/nslcd



Author: arthur
Date: Sat Dec 10 23:17:02 2011
New Revision: 1568
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?revision=1568&view=revision

Log:
properly handle failures to truncate the pid file

Modified:
   nss-pam-ldapd/nslcd/nslcd.c

Modified: nss-pam-ldapd/nslcd/nslcd.c
==============================================================================
--- nss-pam-ldapd/nslcd/nslcd.c Sat Dec 10 22:09:53 2011        (r1567)
+++ nss-pam-ldapd/nslcd/nslcd.c Sat Dec 10 23:17:02 2011        (r1568)
@@ -498,7 +498,11 @@
       log_log(LOG_ERR,"cannot lock pid file (%s): 
%s",filename,strerror(errno));
       exit(EXIT_FAILURE);
     }
-    ftruncate(fd,0);
+    if (ftruncate(fd,0)<0)
+    {
+      log_log(LOG_ERR,"cannot truncate pid file (%s): 
%s",filename,strerror(errno));
+      exit(EXIT_FAILURE);
+    }
     mysnprintf(buffer,sizeof(buffer),"%d\n",(int)getpid());
     if (write(fd,buffer,strlen(buffer))!=(int)strlen(buffer))
     {
-- 
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits/