Beispiel #1
0
int main(int argc, char *argv[])
{
    openlog("gpsdctl", 0, LOG_DAEMON);
    if (argc != 3) {
	(void)syslog(LOG_ERR, "requires action and argument (%d)", argc);
	exit(1);
    } else {
	/*@-observertrans@*/
	char *sockenv = getenv("GPSD_SOCKET");
	char *optenv = getenv("GPSD_OPTIONS");

	if (sockenv != NULL)
	    control_socket = sockenv;
	if (optenv != NULL)
	    gpsd_options = optenv;

	if (gpsd_control(argv[1], argv[2]) < 0)
	    exit(1);
	else
	    exit(0);
	/*@+observertrans@*/
    }
}
Beispiel #2
0
int main(int argc, char *argv[])
{
    openlog("gpsdctl", 0, LOG_DAEMON);
    if (argc != 3) {
	(void)syslog(LOG_ERR, "requires action and argument (%d)", argc);
	exit(EXIT_FAILURE);
    } else {
	char *sockenv = getenv("GPSD_SOCKET");
	char *optenv = getenv("GPSD_OPTIONS");

	if (sockenv != NULL)
	    control_socket = sockenv;
	else if (geteuid() != 0)
	    control_socket = DEFAULT_GPSD_TEST_SOCKET;
	if (optenv != NULL)
	    gpsd_options = optenv;

	/* coverity[string_size] */
	if (gpsd_control(argv[1], argv[2]) < 0)
	    exit(EXIT_FAILURE);
	else
	    exit(EXIT_SUCCESS);
    }
}