diff --git a/ip/ipaddress.c b/ip/ipaddress.c index 85958e1a..c94ddba8 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -49,9 +49,9 @@ static void usage(void) __attribute__((noreturn)); static void usage(void) { - if (do_link) { + if (do_link) iplink_usage(); - } + fprintf(stderr, "Usage: ip address {add|change|replace} IFADDR dev IFNAME [ LIFETIME ]\n"); fprintf(stderr, " [ CONFFLAG-LIST ]\n"); fprintf(stderr, " ip address del IFADDR dev IFNAME [mngtmpaddr]\n"); @@ -77,7 +77,7 @@ static void usage(void) fprintf(stderr, " bridge | bond | ipoib | ip6tnl | ipip | sit | vxlan | lowpan |\n"); fprintf(stderr, " gre | gretap | erspan | ip6gre | ip6gretap | ip6erspan | vti |\n"); fprintf(stderr, " nlmon | can | bond_slave | ipvlan | geneve | bridge_slave |\n"); - fprintf(stderr, " hsr | macsec | netdevsim\n"); + fprintf(stderr, " hsr | macsec | netdevsim }\n"); exit(-1); } @@ -1946,7 +1946,7 @@ static int ipaddr_list_flush_or_save(int argc, char **argv, int action) exit(1); } delete_json_obj(); - exit(0); + goto out; } if (filter.family != AF_PACKET) { diff --git a/lib/namespace.c b/lib/namespace.c index 43e0fe34..06ae0a48 100644 --- a/lib/namespace.c +++ b/lib/namespace.c @@ -82,19 +82,13 @@ int netns_switch(char *name) /* Mount a version of /sys that describes the network namespace */ - if (statvfs("/sys", &fsstat) < 0) { - fprintf(stderr, "could not stat /sys (not mounted?): %s\n",strerror(errno)); - return -1; - } - if (fsstat.f_flag & ST_RDONLY) { - /* If /sys is not writable (e.g. in a container), we can't - * unmount the old /sys instance, but we can still mount a new - * read-only instance over it. */ - mountflags = MS_RDONLY; - } else { - if (umount2("/sys", MNT_DETACH) < 0) { - fprintf(stderr, "umount of /sys failed: %s\n", strerror(errno)); - return -1; + if (umount2("/sys", MNT_DETACH) < 0) { + /* If this fails, perhaps there wasn't a sysfs instance mounted. Good. */ + if (statvfs("/sys", &fsstat) == 0) { + /* We couldn't umount the sysfs, we'll attempt to overlay it. + * A read-only instance can't be shadowed with a read-write one. */ + if (fsstat.f_flag & ST_RDONLY) + mountflags = MS_RDONLY; } } if (mount(name, "/sys", "sysfs", mountflags, NULL) < 0) { diff --git a/tc/tc.c b/tc/tc.c index fbc23dd9..a5a654f8 100644 --- a/tc/tc.c +++ b/tc/tc.c @@ -405,6 +405,7 @@ static int batch(const char *name) err = do_cmd(largc, largv, tail == NULL ? NULL : tail->buf, tail == NULL ? 0 : sizeof(tail->buf)); + fflush(stdout); if (err != 0) { fprintf(stderr, "Command failed %s:%d\n", name, cmdlineno - 1);