X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=utilities%2Fovs-appctl.c;h=742603bda999152bf5071697100259545cb9e8be;hb=a4c1a933e99f9df7d700c72fddb8e05f94e6f7c8;hp=060e8e286db91c413721d7e67c23e501c547fef0;hpb=d65349ea28bb67a0062a9b4b60ff97538206373b;p=openvswitch diff --git a/utilities/ovs-appctl.c b/utilities/ovs-appctl.c index 060e8e28..742603bd 100644 --- a/utilities/ovs-appctl.c +++ b/utilities/ovs-appctl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009 Nicira Networks. + * Copyright (c) 2008, 2009, 2010 Nicira Networks. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +45,6 @@ main(int argc, char *argv[]) int i; set_program_name(argv[0]); - time_init(); /* Parse command line and connect to target. */ target = parse_command_line(argc, argv); @@ -66,11 +65,16 @@ main(int argc, char *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; } @@ -170,17 +174,16 @@ connect_to_target(const char *target) 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); }