.
.IP "\fB-t \fIsecs\fR"
.IQ "\fB--timeout=\fIsecs\fR"
-Limits runtime to approximately \fIsecs\fR seconds. If the timeout
-expires, \fBovs\-vsctl\fR will exit with a \fBSIGALRM\fR signal.
-(This would normally happen only if the database cannot be contacted.)
+Limits runtime to approximately \fIsecs\fR seconds. A value of
+zero will cause \fBovs\-vsctl\fR to wait forever. If the timeout expires,
+\fBovs\-vsctl\fR will exit with a \fBSIGALRM\fR signal. If this option is
+not used, \fBovs\-vsctl\fR uses a timeout of five seconds.
+(A timeout would normally happen only if the database cannot be contacted.)
.
.so lib/vlog.man
.
/* --dry-run: Do not commit any changes. */
static bool dry_run;
+/* --timeout: Time to wait for a connection to 'db'. */
+static int timeout = 5;
+
static void vsctl_fatal(const char *, ...) PRINTF_FORMAT(1, 2) NO_RETURN;
static char *default_db(void);
static void usage(void) NO_RETURN;
vlog_set_levels(VLM_reconnect, VLF_ANY_FACILITY, VLL_WARN);
parse_options(argc, argv);
+ if (timeout) {
+ time_alarm(timeout);
+ }
+
/* Log our arguments. This is often valuable for debugging systems. */
ds_init(&args);
for (i = 1; i < argc; i++) {
case 't':
timeout = strtoul(optarg, NULL, 10);
- if (timeout <= 0) {
- ovs_fatal(0, "value %s on -t or --timeout is not at least 1",
+ if (timeout < 0) {
+ ovs_fatal(0, "value %s on -t or --timeout is invalid",
optarg);
- } else {
- time_alarm(timeout);
}
break;