summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-cluster/openmosixview/files/openmosixview-1.5-nonodestmp.diff')
-rw-r--r--sys-cluster/openmosixview/files/openmosixview-1.5-nonodestmp.diff117
1 files changed, 117 insertions, 0 deletions
diff --git a/sys-cluster/openmosixview/files/openmosixview-1.5-nonodestmp.diff b/sys-cluster/openmosixview/files/openmosixview-1.5-nonodestmp.diff
new file mode 100644
index 000000000000..f49b7e986934
--- /dev/null
+++ b/sys-cluster/openmosixview/files/openmosixview-1.5-nonodestmp.diff
@@ -0,0 +1,117 @@
+--- 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;
+ }
+