Blob Blame History Raw
From 2f1dcbb75a96f5e12ed56c665b3bdd48d4bf6011 Mon Sep 17 00:00:00 2001
From: Pino Toscano <toscano.pino@tiscali.it>
Date: Thu, 12 Feb 2015 23:03:28 +0100
Subject: [PATCH] services: use PATH_MAX instead of FILENAME_MAX

In a Linux-specific code, use PATH_MAX instead of FILENAME_MAX as
buffer size for getcwd().
---
 services/logging.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/services/logging.cpp b/services/logging.cpp
index 4291f0c..c476a97 100644
--- a/services/logging.cpp
+++ b/services/logging.cpp
@@ -25,6 +25,7 @@
 #include "logging.h"
 #include <fstream>
 #include <signal.h>
+#include <limits.h>
 #ifdef __linux__
 #include <dlfcn.h>
 #endif
@@ -63,7 +64,7 @@ void setup_debug(int level, const string &filename, const string &prefix)
 #ifdef __linux__
 
         if (fname[0] != '/') {
-            char buf[FILENAME_MAX];
+            char buf[PATH_MAX];
 
             if (getcwd(buf, sizeof(buf))) {
                 fname.insert(0, "/");