Looking at the source, the problem seem to be that the struct stat
member st_mtime is not the same type as time_t.

I've flagged the problematic lines with **:


static time_t   last_mtim;
[...]
     struct stat statbuf;

     if (stat(f, &statbuf) == 0) {
         /* If the modification times have changed */
#if defined(HAVE_ST_MTIME_WITH_E) && defined(HAVE_STAT_TIME_T)
#ifdef PCP_DEBUG
        if (pmDebug & DBG_TRACE_PMNS) {
            fprintf(stderr, "__pmHasPMNSFileChanged(%s) -> %s last=%d now=%d\n",
                filename == PM_NS_DEFAULT || (__psint_t)filename == 0xffffffff 
? "PM_NS_DEFAULT" : filename,
**              f, (int)last_mtim, (int)statbuf.st_mtime);
        }
#endif
**       return ((statbuf.st_mtime == last_mtim) ? 0 : 1);
[...]
    {
        struct stat statbuf;
        if (stat(fname, &statbuf) == 0) {
#if defined(HAVE_ST_MTIME_WITH_E)
**          last_mtim = statbuf.st_mtime; /* possible struct assignment */
#elif defined(HAVE_ST_MTIME_WITH_SPEC)
            last_mtim = statbuf.st_mtimespec; /* possible struct assignment */
#else
            last_mtim = statbuf.st_mtim; /* possible struct assignment */
#endif
        }
    }

last_mtime can't be converted to int, compared to statbuf.st_mtime or
get an assignment from statbuf.st_mtime.  I'm not quite sure how the
st_mtime membe variable can end up being different from time_t.
Perhaps some missing include file?  The stat(2) manual page state that
these are needed:

  #include <sys/types.h>
  #include <sys/stat.h>
  #include <unistd.h>

The pmns.c source only include <sys/stat.h>.  If that is the solution,
here is a patch:

diff -ur pcp-2.9.0/src/libpcp/src/pmns.c pcp-2.9.0-pere/src/libpcp/src/pmns.c
--- pcp-2.9.0/src/libpcp/src/pmns.c     2009-04-24 02:20:09.000000000 +0200
+++ pcp-2.9.0-pere/src/libpcp/src/pmns.c        2009-08-31 05:06:41.000000000 
+0200
@@ -16,7 +16,9 @@
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  */

+#include <sys/types.h>
 #include <sys/stat.h>
+#include <unistd.h>
 #include <stddef.h>
 #include <assert.h>
 #include <ctype.h>

Happy hacking,
-- 
Petter Reinholdtsen



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to