/*
- * Copyright (c) 2008, 2009 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
int i;
set_program_name(argv[0]);
- time_init();
/* Parse command line and connect to target. */
target = parse_command_line(argc, argv);
ovs_fatal(error, "%s: transaction error", target);
}
if (code / 100 != 2) {
+ fputs(reply, stderr);
ovs_error(0, "%s: server returned reply code %03d", target, code);
exit(2);
}
fputs(reply, stdout);
+ unixctl_client_destroy(client);
+ free(reply);
+ ds_destroy(&request);
+
return 0;
}
"usage: %s [TARGET] COMMAND [ARG...]\n"
"Targets:\n"
" -t, --target=TARGET pidfile or socket to contact\n"
- "Common commands:"
+ "Common commands:\n"
" help List commands supported by the target\n"
" vlog/list List current logging levels\n"
" vlog/set MODULE[:FACILITY[:LEVEL]]\n"
{"execute", no_argument, NULL, 'e'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'},
- {0, 0, 0, 0},
+ {NULL, 0, NULL, 0},
};
const char *target;
int e_options;
if (target[0] != '/') {
char *pidfile_name;
- char *socket_name;
pid_t pid;
- pidfile_name = xasprintf("%s/%s.pid", ovs_rundir, target);
+ pidfile_name = xasprintf("%s/%s.pid", ovs_rundir(), target);
pid = read_pidfile(pidfile_name);
if (pid < 0) {
ovs_fatal(-pid, "cannot read pidfile \"%s\"", pidfile_name);
}
free(pidfile_name);
socket_name = xasprintf("%s/%s.%ld.ctl",
- ovs_rundir, target, (long int) pid);
+ ovs_rundir(), target, (long int) pid);
} else {
socket_name = xstrdup(target);
}