diff options
Diffstat (limited to 'sys-cluster/openmosixview/files/openmosixview-1.5-nonodestmp.diff')
-rw-r--r-- | sys-cluster/openmosixview/files/openmosixview-1.5-nonodestmp.diff | 117 |
1 files changed, 0 insertions, 117 deletions
diff --git a/sys-cluster/openmosixview/files/openmosixview-1.5-nonodestmp.diff b/sys-cluster/openmosixview/files/openmosixview-1.5-nonodestmp.diff deleted file mode 100644 index f49b7e986934..000000000000 --- a/sys-cluster/openmosixview/files/openmosixview-1.5-nonodestmp.diff +++ /dev/null @@ -1,117 +0,0 @@ ---- openmosixview-1.5.orig/openmosixprocs/openmosixprocs.cpp -+++ openmosixview-1.5/openmosixprocs/openmosixprocs.cpp -@@ -19,6 +19,9 @@ - #include <config.h> - #endif - -+#include <cstring> -+#include <cstdio> -+ - #include <qaccel.h> - #include "openmosixprocs.h" - -@@ -126,22 +129,29 @@ - string which; - char zeile[201]; - string nodename; -- which = which + clustercommand + " whois "; -- which = which + node + " > /tmp/nodes.tmp"; -- system(which.c_str()); -- if (file_exist("/tmp/nodes.tmp")) { -- std::ifstream readnodename("/tmp/nodes.tmp"); -- if (readnodename) { -- readnodename.getline(zeile, 200); -- nodename.erase(); -- nodename= nodename+zeile; -- readnodename.close(); -- } else { -- cout << "could not read from /tmp/nodes.tmp" << endl; -- return 0; -- } -+ -+ which += " whois "; -+ which += node; -+ -+ FILE *fp = popen(which.c_str(), "r"); -+ if (!fp) -+ { -+ cout << "could not run " << clustercommand << endl; - } -- unlink("/tmp/nodes.tmp"); -+ -+ int n; -+ while ((n = fread(zeile, 1, 200, fp)) > 0) -+ { -+ int count; // only copy the first line, and skip the \n -+ for (count = 0; count < n; count++) -+ if (zeile[count] == '\n') -+ break; -+ nodename.append(zeile,count); -+ if (count != n) -+ break; -+ } -+ fclose(fp); -+ - return nodename; - - } - ---- openmosixview-1.5.orig/openmosixview/openmosixview.cpp -+++ openmosixview-1.5/openmosixview/openmosixview.cpp -@@ -16,6 +16,8 @@ - ***************************************************************************/ - - #include <qaccel.h> -+#include <cstring> -+#include <cstdio> - #include "openmosixview.h" - #include "filesave.xpm" - #include "fileopen.xpm" -@@ -454,24 +456,32 @@ - // converts a cluster id to an hostname - string OpenMosixViewApp::getnodename(string node) { - // gather nodes hostname -- string which; -+ string which(clustercommand); - char zeile[201]; - string nodename; -- which = which + clustercommand + " whois "; -- which = which + node + " > /tmp/nodes.tmp"; -- system(which.c_str()); -- if (file_exist("/tmp/nodes.tmp")) { -- std::ifstream readnodename("/tmp/nodes.tmp"); -- if (readnodename) { -- readnodename.getline(zeile, 200); -- nodename.erase(); -- nodename= nodename+zeile; -- readnodename.close(); -- } else { -- cout << "could not read from /tmp/nodes.tmp" << endl; -- return 0; -- } -+ -+ which += " whois "; -+ which += node; -+ -+ FILE *fp = popen(which.c_str(), "r"); -+ if (!fp) -+ { -+ cout << "could not run " << clustercommand << endl; - } -+ -+ int n; -+ while ((n = fread(zeile, 1, 200, fp)) > 0) -+ { -+ int count; -+ for (count = 0; count < n; count++) -+ if (zeile[count] == '\n') -+ break; -+ nodename.append(zeile,count); -+ if (count != n) -+ break; -+ } -+ fclose(fp); -+ - return nodename; - } - |