]> git.lyx.org Git - lyx.git/blobdiff - src/support/socktools.C
* src/text2.C: deleteEmptyParagraphMechanism(): fix a crash in
[lyx.git] / src / support / socktools.C
index 1142cb69bcd2bf78002ecccf4d7862bc55135baf..6649df6fa9c544a9197f3ff168ce8894f32471b6 100644 (file)
 #include <config.h>
 
 #include "support/socktools.h"
+#include "support/filename.h"
+
+#if !defined (HAVE_FCNTL)
+// We provide stubs because we don't (yet?) support the native OS API.
+
+namespace lyx {
+namespace support {
+namespace socktools {
+
+int listen(std::string const &, int)
+{
+       return -1;
+}
+
+
+int accept(int)
+{
+       return -1;
+}
+
+} // namespace socktools
+} // namespace support
+} // namespace lyx
+
+#else // defined (HAVE_FCNTL)
+
 #include "support/lyxlib.h"
 
 #include "debug.h"
@@ -19,7 +45,7 @@
 #include <sys/un.h>
 #include <fcntl.h>
 #ifdef HAVE_UNISTD_H
-#include <unistd.h>
+# include <unistd.h>
 #endif
 
 #include <cerrno>
@@ -89,7 +115,7 @@ int listen(string const & name, int queue)
                lyxerr << "lyx: Could not bind address '" << name
                       << "' to socket descriptor: " << strerror(errno) << endl;
                ::close(fd);
-               lyx::support::unlink(name);
+               unlink(FileName(name));
                return -1;
        }
 
@@ -102,7 +128,7 @@ int listen(string const & name, int queue)
                lyxerr << "lyx: Could not put socket in 'listen' state: "
                       << strerror(errno) << endl;
                ::close(fd);
-               lyx::support::unlink(name);
+               unlink(FileName(name));
                return -1;
        }
 
@@ -137,3 +163,5 @@ int accept(int sd)
 } // namespace socktools
 } // namespace support
 } // namespace lyx
+
+#endif // defined (HAVE_FCNTL)