]> git.lyx.org Git - features.git/blobdiff - src/support/socktools.cpp
Implement on screen numbering for Subequation module
[features.git] / src / support / socktools.cpp
index 7537e126043afd9f91b5ec37b2f4fe45237d8b8f..d014f45e9483284b77ace0c3b9cb21b8171a7927 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author João Luis M. Assirati
+ * \author João Luis M. Assirati
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -37,10 +37,11 @@ int accept(int)
 
 #else // defined (HAVE_FCNTL)
 
-#include "support/lyxlib.h"
-
 #include "support/debug.h"
 
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <fcntl.h>
@@ -49,6 +50,9 @@ int accept(int)
 #endif
 
 #include <cerrno>
+#include <string>
+//needed for Mac OSX 10.5.2 Leopard
+#include <cstring>
 
 using namespace std;
 
@@ -78,7 +82,7 @@ int listen(FileName const & name, int queue)
        string::size_type len = localname.size();
        // the field sun_path in sockaddr_un is a char[108]
        if (len > 107) {
-               LYXERR0("lyx: Socket address '" << name.absFilename() << "' too long.");
+               LYXERR0("lyx: Socket address '" << name.absFileName() << "' too long.");
                return -1;
        }
        // Synonims for AF_UNIX are AF_LOCAL and AF_FILE
@@ -107,8 +111,15 @@ int listen(FileName const & name, int queue)
        // bind() gives the local address 'name' for 'fd', also creating
        // the socket special file in the filesystem. bind() returns -1
        // in case of error
+       //
+       // Using Clang and fsanitize suggests there is an issue here but we do
+       // not understand the code enough to change it and we are not aware of
+       // how to trigger a crash or other issue while using LyX, so we leave
+       // it as is. For ML discussion, see here:
+       //   https://www.mail-archive.com/search?l=mid&q=20211227113249.53bf5a63%40admin1-desktop
+       //
        if ((::bind (fd, reinterpret_cast<sockaddr *>(&addr), SUN_LEN(&addr))) == -1) {
-               LYXERR0("lyx: Could not bind address '" << name.absFilename()
+               LYXERR0("lyx: Could not bind address '" << name.absFileName()
                       << "' to socket descriptor: " << strerror(errno));
                ::close(fd);
                name.removeFile();