author | zecke <zecke> | 2004-11-15 15:25:22 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-11-15 15:25:22 (UTC) |
commit | ef26112d97cd5573642a0f00fd54347229857402 (patch) (side-by-side diff) | |
tree | cb62b1e2a6a6a5ccd301fcbb0faac535ff865ee1 /noncore/settings/sshkeys/sshkeys.cpp | |
parent | 3b935c93d5576e6590ed89c75066983124e2c628 (diff) | |
download | opie-ef26112d97cd5573642a0f00fd54347229857402.zip opie-ef26112d97cd5573642a0f00fd54347229857402.tar.gz opie-ef26112d97cd5573642a0f00fd54347229857402.tar.bz2 |
-Remove char cast for homedir but use QFile::encodeName
-Make it quicklaunchable
Diffstat (limited to 'noncore/settings/sshkeys/sshkeys.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/sshkeys/sshkeys.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/noncore/settings/sshkeys/sshkeys.cpp b/noncore/settings/sshkeys/sshkeys.cpp index cebc845..d8b1014 100644 --- a/noncore/settings/sshkeys/sshkeys.cpp +++ b/noncore/settings/sshkeys/sshkeys.cpp @@ -23,2 +23,4 @@ #include <qpe/qpeapplication.h> +#include <qdir.h> +#include <qfile.h> #include <qmultilineedit.h> @@ -30,2 +32,4 @@ #include <sys/stat.h> +#include <fcntl.h> +#include <sys/ioctl.h> #include <stdlib.h> @@ -41,3 +45,11 @@ SSHKeysApp::SSHKeysApp( QWidget* parent, const char* name, WFlags fl ) { - char *home = getenv("HOME"); + /* If we had a controlling TTY, detach from it. + This is to ensure that SSH uses ssh-askpass */ + int fd = open("/dev/tty", O_RDONLY); + if (fd != -1) { + ioctl(fd, TIOCNOTTY, NULL); + close(fd); + } + + QCString home = QFile::encodeName( QDir::homeDirPath() ); unsigned i; @@ -63,3 +75,3 @@ SSHKeysApp::SSHKeysApp( QWidget* parent, const char* name, WFlags fl ) thiskeyname[31] = 0; - snprintf(thiskeyname, 31, "%s/.ssh/%s", home, keynames[i]); + snprintf(thiskeyname, 31, "%s/.ssh/%s", home.data(), keynames[i]); if (!access(thiskeyname, R_OK)) { |