View | Details | Raw Unified | Return to bug 45029
Collapse All | Expand All

(-)a/ssh-agent.c (-9 / +15 lines)
Lines 1510-1525 main(int ac, char **av) Link Here
1510
1510
1511
		pidstr = getenv(SSH_AGENTPID_ENV_NAME);
1511
		pidstr = getenv(SSH_AGENTPID_ENV_NAME);
1512
		if (pidstr == NULL) {
1512
		if (pidstr == NULL) {
1513
			fatal("%s not set, cannot kill agent",
1513
			fprintf(stderr, "%s not set, cannot kill agent\n",
1514
			      SSH_AGENTPID_ENV_NAME);
1514
			    SSH_AGENTPID_ENV_NAME);
1515
			exit(1);
1515
		}
1516
		}
1516
		pid = (int)strtonum(pidstr, 2, INT_MAX, &errstr);
1517
		pid = (int)strtonum(pidstr, 2, INT_MAX, &errstr);
1517
		if (errstr) {
1518
		if (errstr) {
1518
			fatal( "%s=\"%s\", which is not a good PID: %s",
1519
			fprintf(stderr,
1519
			      SSH_AGENTPID_ENV_NAME, pidstr, errstr);
1520
			    "%s=\"%s\", which is not a good PID: %s\n",
1521
			    SSH_AGENTPID_ENV_NAME, pidstr, errstr);
1522
			exit(1);
1520
		}
1523
		}
1521
		if (kill(pid, SIGTERM) == -1) {
1524
		if (kill(pid, SIGTERM) == -1) {
1522
			fatal("kill: %m");
1525
			perror("kill");
1526
			exit(1);
1523
		}
1527
		}
1524
		format = c_flag ? "unsetenv %s;\n" : "unset %s;\n";
1528
		format = c_flag ? "unsetenv %s;\n" : "unset %s;\n";
1525
		printf(format, SSH_AUTHSOCKET_ENV_NAME);
1529
		printf(format, SSH_AUTHSOCKET_ENV_NAME);
Lines 1553-1559 main(int ac, char **av) Link Here
1553
		/* Create private directory for agent socket */
1557
		/* Create private directory for agent socket */
1554
		mktemp_proto(socket_dir, sizeof(socket_dir));
1558
		mktemp_proto(socket_dir, sizeof(socket_dir));
1555
		if (mkdtemp(socket_dir) == NULL) {
1559
		if (mkdtemp(socket_dir) == NULL) {
1556
			fatal("mkdtemp: private socket dir: %m");
1560
			perror("mkdtemp: private socket dir");
1561
			exit(1);
1557
		}
1562
		}
1558
		snprintf(socket_name, sizeof socket_name,
1563
		snprintf(socket_name, sizeof socket_name,
1559
			 "%s/agent.%ld", socket_dir, (long)parent_pid);
1564
			 "%s/agent.%ld", socket_dir, (long)parent_pid);
Lines 1626-1635 main(int ac, char **av) Link Here
1626
		}
1631
		}
1627
		if (setenv(SSH_AUTHSOCKET_ENV_NAME, socket_name, 1) == -1 ||
1632
		if (setenv(SSH_AUTHSOCKET_ENV_NAME, socket_name, 1) == -1 ||
1628
		    setenv(SSH_AGENTPID_ENV_NAME, pidstrbuf, 1) == -1) {
1633
		    setenv(SSH_AGENTPID_ENV_NAME, pidstrbuf, 1) == -1) {
1629
			fatal("setenv: %m");
1634
			perror("setenv");
1635
			exit(1);
1630
		}
1636
		}
1631
		execvp(av[0], av);
1637
		execvp(av[0], av);
1632
		fatal("execvp: %s: %m", av[0]);
1638
		perror(av[0]);
1639
		exit(1);
1633
	}
1640
	}
1634
	/* child */
1641
	/* child */
1635
	log_init(__progname, SYSLOG_LEVEL_INFO, SYSLOG_FACILITY_AUTH, 0);
1642
	log_init(__progname, SYSLOG_LEVEL_INFO, SYSLOG_FACILITY_AUTH, 0);
1636
- 

Return to bug 45029