lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1757 - in nss-pam-ldapd-0.7: . nslcd

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

nss-pam-ldapd commit: r1757 - in nss-pam-ldapd-0.7: . nslcd



Author: arthur
Date: Sat Sep  8 18:08:06 2012
New Revision: 1757
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?revision=1757&view=revision

Log:
properly handle failures to truncate the pid file (r1568 from 0.8)

Modified:
   nss-pam-ldapd-0.7/   (props changed)
   nss-pam-ldapd-0.7/nslcd/nslcd.c

Modified: nss-pam-ldapd-0.7/nslcd/nslcd.c
==============================================================================
--- nss-pam-ldapd-0.7/nslcd/nslcd.c     Sat Sep  8 18:00:08 2012        (r1756)
+++ nss-pam-ldapd-0.7/nslcd/nslcd.c     Sat Sep  8 18:08:06 2012        (r1757)
@@ -517,7 +517,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/