Revert "tc: fix batch force option"

This reverts commit b133392468.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Stephen Hemminger 2019-07-31 17:19:33 -07:00
parent 350bc27cf3
commit bfdda70d59
1 changed files with 8 additions and 11 deletions

19
tc/tc.c
View File

@ -334,7 +334,6 @@ static int batch(const char *name)
int batchsize = 0; int batchsize = 0;
size_t len = 0; size_t len = 0;
int ret = 0; int ret = 0;
int err;
bool send; bool send;
batch_mode = 1; batch_mode = 1;
@ -403,9 +402,9 @@ static int batch(const char *name)
continue; /* blank line */ continue; /* blank line */
} }
err = do_cmd(largc, largv, tail == NULL ? NULL : tail->buf, ret = do_cmd(largc, largv, tail == NULL ? NULL : tail->buf,
tail == NULL ? 0 : sizeof(tail->buf)); tail == NULL ? 0 : sizeof(tail->buf));
if (err != 0) { if (ret != 0) {
fprintf(stderr, "Command failed %s:%d\n", name, fprintf(stderr, "Command failed %s:%d\n", name,
cmdlineno - 1); cmdlineno - 1);
ret = 1; ret = 1;
@ -427,17 +426,15 @@ static int batch(const char *name)
iov->iov_len = n->nlmsg_len; iov->iov_len = n->nlmsg_len;
} }
err = rtnl_talk_iov(&rth, iovs, batchsize, NULL); ret = rtnl_talk_iov(&rth, iovs, batchsize, NULL);
put_batch_bufs(&buf_pool, &head, &tail); if (ret < 0) {
free(iovs);
if (err < 0) {
fprintf(stderr, "Command failed %s:%d\n", name, fprintf(stderr, "Command failed %s:%d\n", name,
cmdlineno - (batchsize + err) - 1); cmdlineno - (batchsize + ret) - 1);
ret = 1; return 2;
if (!force)
break;
} }
put_batch_bufs(&buf_pool, &head, &tail);
batchsize = 0; batchsize = 0;
free(iovs);
} }
} while (!lastline); } while (!lastline);