diff options
Diffstat (limited to 'nixpkgs/pkgs/applications/display-managers/slim/no-logfile.patch')
-rw-r--r-- | nixpkgs/pkgs/applications/display-managers/slim/no-logfile.patch | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/nixpkgs/pkgs/applications/display-managers/slim/no-logfile.patch b/nixpkgs/pkgs/applications/display-managers/slim/no-logfile.patch deleted file mode 100644 index f2f5f1549930..000000000000 --- a/nixpkgs/pkgs/applications/display-managers/slim/no-logfile.patch +++ /dev/null @@ -1,80 +0,0 @@ -diff --git a/log.cpp b/log.cpp -index b44677a..7c89dda 100644 ---- a/log.cpp -+++ b/log.cpp -@@ -1,23 +1,31 @@ - #include "log.h" - #include <iostream> -+#include <cstring> - - bool - LogUnit::openLog(const char * filename) - { -- if (logFile.is_open()) { -+ if (isFile && logFile.is_open()) { - cerr << APPNAME - << ": opening a new Log file, while another is already open" - << endl; -- logFile.close(); -+ closeLog(); - } -- logFile.open(filename, ios_base::app); - -- return !(logFile.fail()); -+ if (strcmp(filename, "/dev/stderr") == 0) { -+ isFile = false; -+ return true; -+ } else { -+ logFile.open(filename, ios_base::app); -+ isFile = true; -+ return !(logFile.fail()); -+ } - } - - void - LogUnit::closeLog() - { -+ if (!isFile) return; - if (logFile.is_open()) - logFile.close(); - } -diff --git a/log.h b/log.h -index b7810be..ad548a2 100644 ---- a/log.h -+++ b/log.h -@@ -9,11 +9,14 @@ - #endif - #include "const.h" - #include <fstream> -+#include <iostream> - - using namespace std; - - static class LogUnit { - ofstream logFile; -+ bool isFile; -+ inline ostream &getStream() { return isFile ? logFile : cerr; } - public: - bool openLog(const char * filename); - void closeLog(); -@@ -22,17 +25,17 @@ public: - - template<typename Type> - LogUnit & operator<<(const Type & text) { -- logFile << text; logFile.flush(); -+ getStream() << text; getStream().flush(); - return *this; - } - - LogUnit & operator<<(ostream & (*fp)(ostream&)) { -- logFile << fp; logFile.flush(); -+ getStream() << fp; getStream().flush(); - return *this; - } - - LogUnit & operator<<(ios_base & (*fp)(ios_base&)) { -- logFile << fp; logFile.flush(); -+ getStream() << fp; getStream().flush(); - return *this; - } - } logStream; |