* @author Olivier Valentin <olivier.valentin@us.ibm.com>
* @author Alexandre Ratchov <alexandre.ratchov@bull.net>
* @date 2010-03-31
- * cleanup 2011-04-26 SM
+ * cleanup 2012-01-05 SM
*
*/
#include <sys/socket.h>
#include <openpts.h>
-// #include <log.h>
/* chanegd by unit test */
char *ptsc_command = "/usr/sbin/ptsc -m";
pid_t pid;
int socket_pair[2]; // socket[1] is the SSH side
+ /* check */
+ if (host == NULL) {
+ LOG(LOG_ERR, "null input");
+ return -1;
+ }
+ /* socket */
if (socketpair(AF_UNIX, SOCK_STREAM, 0, socket_pair) == -1) {
- ERROR("socketpair()");
+ LOG(LOG_ERR, "socketpair() fail");
goto err;
}
+ /* fork */
if ((pid = fork()) == -1) {
- ERROR("fork()");
+ LOG(LOG_ERR, "fork() fail");
goto err_close;
}
-
if (pid == 0) {
- // child process
+ /* child process */
char *arguments[16];
int arg_idx = 0;
char identity_string[PATH_MAX + /* "IdentityFile " */ 13];
}
arguments[arg_idx++] = host;
arguments[arg_idx++] = ptsc_command;
- // arguments[arg_idx++] = "ptsc";
- // arguments[arg_idx++] = "-m";
#if 0
+ // TODO
/* Sync verbose level between verifier and collector? */
- // {
+ if (verbose_sync) {
int verboseLevel;
for ( verboseLevel = 0; (verboseLevel < getVerbosity()) && (arg_idx < 15); verboseLevel++ ) {
arguments[arg_idx++] = "-v";
}
- // }
+ }
#endif
arguments[arg_idx++] = NULL;
-DEBUG("ptsc_command %s\n", ptsc_command);
+ DEBUG("ptsc_command %s\n", ptsc_command);
execvp("ssh", arguments);
- ERROR("execvp(ssh)");
+ LOG(LOG_ERR, "execvp(ssh)");
exit(1);
}