<html dir="ltr"><head></head><body style="text-align:left; direction:ltr;"><div>Hi,</div><div><br></div><div>I've come across two threads regarding Xymon checking that FILE is type=symlink.</div><div>Both talked about an untested patch, which has been included for "some time".</div><div>However, it doesn't work. I'd get the same "File is a file - should be symlink" (<a href="https://xymon.xymon.narkive.com/Fn4s9A2v/checking-for-symlinks"><a href="https://xymon.xymon.narkive.com/Fn4s9A2v/checking-for-symlinks">https://xymon.xymon.narkive.com/Fn4s9A2v/checking-for-symlinks</a>)</a></div><div><br></div><div>So I fixed it, I think.</div><div>Patch attached.</div><div><br></div><div>In case the attachment doesn't come through, the only code change is this;</div><div><br></div><div>Index: xymond/client_config.c</div><div>===================================================================</div><div>--- xymond/client_config.c      (revision 8119)</div><div>+++ xymond/client_config.c      (working copy)</div><div>@@ -2665,13 +2665,13 @@</div><div> </div><div>                        tstr = strchr(boln, '(');</div><div>                        if (tstr) {</div><div>-                               if (strncmp(tstr, "(file", 5) == 0) ftype = S_IFREG;</div><div>+                               if (strncmp(tstr, "(file)", 6) == 0) ftype = S_IFREG;</div><div>                                else if (strncmp(tstr, "(directory", 10) == 0) ftype = S_IFDIR;</div><div>                                else if (strncmp(tstr, "(char-device", 12) == 0) ftype = S_IFCHR;</div><div>                                else if (strncmp(tstr, "(block-device", 13) == 0) ftype = S_IFBLK;</div><div>                                else if (strncmp(tstr, "(FIFO", 5) == 0) ftype = S_IFIFO;</div><div>                                else if (strncmp(tstr, "(socket", 7) == 0) ftype = S_IFSOCK;</div><div>-                               else if (strstr(tstr, ", symlink -> ") == 0) islink = 1;</div><div>+                               else if (strncmp(tstr, "(file, symlink -> ", 18) == 0) ftype = S_IFLNK, islink = 1;</div><div>                        }</div><div>                }</div><div>                else if (strncmp(boln, "mode:", 5) == 0) {</div><div></div><div><br></div><div><br></div><div><br></div><div><br></div><div>The rest is just changing the references to "Triggers warning if the file is not of the specified type" to include "symlink".</div><div><br></div><div>I'm not convinced by changing the S_IFREG match to '"(file)", 6', maybe there are other types of file I don't know about.</div><div>Possibly putting the revised S_IFLNK match before an unmodified S_IFREG match is best.</div><div>Also I haven't checked that setting 'ftype = S_IFLNK' is necessary.</div><div><br></div><div><br></div><div><span><pre>-- <br></pre><div style="width: 71ch;">Mike Williams<br></div><div style="width: 71ch;" data-evo-signature-plain-text-mode=""><br></div><div style="width: 71ch;"></div></span></div></body></html>