]> git.proxmox.com Git - mirror_lxc.git/log
mirror_lxc.git
6 years agoexecute: skip lxc-init logging when unprivileged
Christian Brauner [Thu, 23 Aug 2018 13:46:12 +0000 (15:46 +0200)]
execute: skip lxc-init logging when unprivileged

Unprivileged app containers will not be able to open the passed in
/proc/1/fd/<idx> log path and will thus currently fail completely as soon as
any log level or log file is passed.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Reported-by: Mrinal Dhillon <mdhillon@juniper.net>
6 years agoMerge pull request #2568 from brauner/2018-08-22/ifaddrs
Wolfgang Bumiller [Thu, 23 Aug 2018 12:26:42 +0000 (14:26 +0200)]
Merge pull request #2568 from brauner/2018-08-22/ifaddrs

include: add safe getifaddrs() version

6 years agoMakefile: conditionalize ifaddrs.h inclusion
Christian Brauner [Wed, 22 Aug 2018 18:28:52 +0000 (20:28 +0200)]
Makefile: conditionalize ifaddrs.h inclusion

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoifaddrs: add safe implementation of getifaddrs()
Christian Brauner [Wed, 22 Aug 2018 15:29:33 +0000 (17:29 +0200)]
ifaddrs: add safe implementation of getifaddrs()

The old version was crazy. This replaces it with an internal version based on
musl.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2565 from brauner/2018-08-22/more_fixes
Stéphane Graber [Wed, 22 Aug 2018 22:54:18 +0000 (18:54 -0400)]
Merge pull request #2565 from brauner/2018-08-22/more_fixes

remove last pam_cgfs special-casing

6 years agoMerge pull request #2567 from stgraber/master
Christian Brauner [Wed, 22 Aug 2018 18:06:14 +0000 (20:06 +0200)]
Merge pull request #2567 from stgraber/master

Fix typo

6 years agoFix typo
Stéphane Graber [Wed, 22 Aug 2018 17:58:17 +0000 (13:58 -0400)]
Fix typo

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
6 years agoconf: add missing headers
Christian Brauner [Wed, 22 Aug 2018 13:52:18 +0000 (15:52 +0200)]
conf: add missing headers

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMakefile: remove last pam_cgfs special-casing
Christian Brauner [Wed, 22 Aug 2018 13:45:54 +0000 (15:45 +0200)]
Makefile: remove last pam_cgfs special-casing

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostring_utils: add remove_trailing_slashes()
Christian Brauner [Wed, 22 Aug 2018 13:45:33 +0000 (15:45 +0200)]
string_utils: add remove_trailing_slashes()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostring_utils: remove unused headers
Christian Brauner [Wed, 22 Aug 2018 13:40:58 +0000 (15:40 +0200)]
string_utils: remove unused headers

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostring_utils: remove unnecessary include
Christian Brauner [Wed, 22 Aug 2018 13:37:41 +0000 (15:37 +0200)]
string_utils: remove unnecessary include

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoinitutils: remove useless comment
Christian Brauner [Wed, 22 Aug 2018 13:37:04 +0000 (15:37 +0200)]
initutils: remove useless comment

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years ago{file,string}_utils: remove NO_LOG
Christian Brauner [Wed, 22 Aug 2018 13:36:15 +0000 (15:36 +0200)]
{file,string}_utils: remove NO_LOG

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2564 from brauner/2018-08-22/strerror_r_detection
Wolfgang Bumiller [Wed, 22 Aug 2018 12:24:08 +0000 (14:24 +0200)]
Merge pull request #2564 from brauner/2018-08-22/strerror_r_detection

log: handle strerror_r() versions + autotools: add --{disable,enable}-thread-safety

6 years agolog: fail build on ENFORCE_THREAD_SAFETY error
Christian Brauner [Wed, 22 Aug 2018 11:27:24 +0000 (13:27 +0200)]
log: fail build on ENFORCE_THREAD_SAFETY error

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoautotools: add --{disable,enable}-thread-safety
Christian Brauner [Wed, 22 Aug 2018 11:13:29 +0000 (13:13 +0200)]
autotools: add --{disable,enable}-thread-safety

Fail the build if --enable-thread-safety is passed and the environment cannot
guarantee thread-safety.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolog: handle strerror_r() versions
Christian Brauner [Wed, 22 Aug 2018 10:25:16 +0000 (12:25 +0200)]
log: handle strerror_r() versions

Closes #2563.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2562 from brauner/2018-08-22/check_compiler
Christian Brauner [Tue, 21 Aug 2018 23:57:28 +0000 (01:57 +0200)]
Merge pull request #2562 from brauner/2018-08-22/check_compiler

autotools: check if compiler is new enough

6 years agostart: add out_sync_fini cleanup label
Christian Brauner [Tue, 21 Aug 2018 23:54:40 +0000 (01:54 +0200)]
start: add out_sync_fini cleanup label

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoautotools: check if compiler is new enough
Christian Brauner [Tue, 21 Aug 2018 22:04:19 +0000 (00:04 +0200)]
autotools: check if compiler is new enough

We line up with the Linux kernel and won't support any compiler under 4.6.
Additionally, we also require at least gnu99 so this is due anyway.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2554 from brauner/2018-08-21/attach_fixes
Stéphane Graber [Tue, 21 Aug 2018 15:59:55 +0000 (11:59 -0400)]
Merge pull request #2554 from brauner/2018-08-21/attach_fixes

attach: bugfixes

6 years agoMerge pull request #2561 from brauner/2018-08-21/test_pam_cgfs
Stéphane Graber [Tue, 21 Aug 2018 15:58:01 +0000 (11:58 -0400)]
Merge pull request #2561 from brauner/2018-08-21/test_pam_cgfs

Makefile: don't allow undefined symbols

6 years agoMakefile: don't allow undefined symbols
Christian Brauner [Tue, 21 Aug 2018 15:13:39 +0000 (17:13 +0200)]
Makefile: don't allow undefined symbols

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agomacro: move macros from attach.c
Christian Brauner [Mon, 20 Aug 2018 23:09:19 +0000 (01:09 +0200)]
macro: move macros from attach.c

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoattach: move struct declaration to top
Christian Brauner [Mon, 20 Aug 2018 23:06:05 +0000 (01:06 +0200)]
attach: move struct declaration to top

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agomacro: s/rexit()/_exit()/g
Christian Brauner [Mon, 20 Aug 2018 23:05:14 +0000 (01:05 +0200)]
macro: s/rexit()/_exit()/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2560 from brauner/2018-08-21/fix_fully_unprivileged_containers
Stéphane Graber [Tue, 21 Aug 2018 14:53:57 +0000 (10:53 -0400)]
Merge pull request #2560 from brauner/2018-08-21/fix_fully_unprivileged_containers

conf: fix devpts mounting when fully unprivileged

6 years agoMerge pull request #2558 from brauner/2018-08-21/pam_cgfs
Stéphane Graber [Tue, 21 Aug 2018 14:52:46 +0000 (10:52 -0400)]
Merge pull request #2558 from brauner/2018-08-21/pam_cgfs

pam_cgfs: build from the same sources as liblxc

6 years agoconf: fix devpts mounting when fully unprivileged
Christian Brauner [Tue, 21 Aug 2018 12:16:09 +0000 (14:16 +0200)]
conf: fix devpts mounting when fully unprivileged

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agopam_cgfs: build from the same sources as liblxc
Christian Brauner [Tue, 21 Aug 2018 09:35:31 +0000 (11:35 +0200)]
pam_cgfs: build from the same sources as liblxc

Closes #2556.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoutils: split into {file,string}_utils.{c,h}
Christian Brauner [Tue, 21 Aug 2018 10:59:07 +0000 (12:59 +0200)]
utils: split into {file,string}_utils.{c,h}

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2559 from ssup2/master
Christian Brauner [Tue, 21 Aug 2018 10:59:49 +0000 (12:59 +0200)]
Merge pull request #2559 from ssup2/master

start: Fix net iface remaining issue

6 years agostart: Fix net iface remaining issue
Jungsub Shin [Tue, 21 Aug 2018 10:21:59 +0000 (19:21 +0900)]
start: Fix net iface remaining issue

When creating container that has multiple net ifaces fails
because of wrong net config, lxc doesn't remove previously created
net ifaces.

Solve this issue with changing return path in lxc_spawn().

Signed-off-by: Jungsub Shin jungsub_shin@tmax.co.kr
6 years agoMerge pull request #2555 from tcharding/clang-format-cmd
Christian Brauner [Tue, 21 Aug 2018 09:25:34 +0000 (11:25 +0200)]
Merge pull request #2555 from tcharding/clang-format-cmd

cmd: Fix format issues found by clang-format

6 years agoMerge pull request #2557 from 2xsec/bugfix
Christian Brauner [Tue, 21 Aug 2018 09:24:52 +0000 (11:24 +0200)]
Merge pull request #2557 from 2xsec/bugfix

list: fix indent

6 years agolist: fix indent
2xsec [Tue, 21 Aug 2018 06:02:06 +0000 (15:02 +0900)]
list: fix indent

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agocmd: Fix format issues found by clang-format
Tobin C. Harding [Mon, 20 Aug 2018 23:44:36 +0000 (09:44 +1000)]
cmd: Fix format issues found by clang-format

clang-format finds a few format issues, lets fix these up.

Fix format issues found by clang-format.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agoMerge pull request #2552 from tcharding/cpp-check
Christian Brauner [Mon, 20 Aug 2018 23:37:31 +0000 (01:37 +0200)]
Merge pull request #2552 from tcharding/cpp-check

cmd: Lint with cppcheck

6 years agocmd: Reduce scope of 'count' variable
Tobin C. Harding [Mon, 20 Aug 2018 06:31:33 +0000 (16:31 +1000)]
cmd: Reduce scope of 'count' variable

Variable is used in one plaice only within a nested statement block.
The code is cleaner if the variable is declared near where it is used.
Found using cppcheck.

Reduce the scope of 'count' variable.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agocmd: Do not reassign variable before it is used
Tobin C. Harding [Mon, 20 Aug 2018 06:28:39 +0000 (16:28 +1000)]
cmd: Do not reassign variable before it is used

cppcheck emits warning

  Variable 'ofd' is reassigned a value before the old one has been used.

We do not need to initialise a variable if it is assigned to on first use.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agoMerge pull request #2549 from brauner/2018-08-19/cmd_usernsexec_fixes
Wolfgang Bumiller [Mon, 20 Aug 2018 13:35:10 +0000 (15:35 +0200)]
Merge pull request #2549 from brauner/2018-08-19/cmd_usernsexec_fixes

cmd: lxc-usernsexec fixes + macro: move declarations + config_utils: macvlan fixes

6 years agocmd: use goto for cleanup in lxc-usernsexec
Christian Brauner [Mon, 20 Aug 2018 12:24:55 +0000 (14:24 +0200)]
cmd: use goto for cleanup in lxc-usernsexec

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2550 from 2xsec/bugfix
Christian Brauner [Mon, 20 Aug 2018 10:34:15 +0000 (12:34 +0200)]
Merge pull request #2550 from 2xsec/bugfix

storage: exit() => _exit()

6 years agoMerge pull request #2542 from tcharding/signal-fail-2523
Christian Brauner [Mon, 20 Aug 2018 10:33:45 +0000 (12:33 +0200)]
Merge pull request #2542 from tcharding/signal-fail-2523

tools: Indicate container startup failure

6 years agoMerge pull request #2553 from Blub/ttydir-path-fixup
Christian Brauner [Mon, 20 Aug 2018 08:37:50 +0000 (10:37 +0200)]
Merge pull request #2553 from Blub/ttydir-path-fixup

conf: fix path/lxcpath mixups in tty setup

6 years agoconf: fix path/lxcpath mixups in tty setup
Wolfgang Bumiller [Mon, 20 Aug 2018 08:02:35 +0000 (10:02 +0200)]
conf: fix path/lxcpath mixups in tty setup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Fixes: 6947153da ("conf: use mknod() to create dummy mount target")
6 years agotools: lxc-wait: add default log priority & cleanups
2xsec [Mon, 20 Aug 2018 01:43:22 +0000 (10:43 +0900)]
tools: lxc-wait: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agostorage: exit() => _exit(). when exec is failed, child process needs to use _exit()
2xsec [Mon, 20 Aug 2018 01:41:50 +0000 (10:41 +0900)]
storage: exit() => _exit(). when exec is failed, child process needs to use _exit()

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agotools: Indicate container startup failure
Tobin C. Harding [Fri, 17 Aug 2018 06:49:46 +0000 (16:49 +1000)]
tools: Indicate container startup failure

When running lxc-autostart we do not currently indicate failure to start
containers, either partial failure i.e. some of the containers failed to
start or total failure i.e. all of the containers failed to start.

Indicate container startup failure.  For total failure exit(1), for
partial failure exit(2).

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agomacro: add macvlan properties
Christian Brauner [Sun, 19 Aug 2018 18:14:25 +0000 (20:14 +0200)]
macro: add macvlan properties

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agomacro: add missing headers
Christian Brauner [Sun, 19 Aug 2018 18:01:45 +0000 (20:01 +0200)]
macro: add missing headers

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocmd: use safe number parsers in lxc-usernsexec
Christian Brauner [Sun, 19 Aug 2018 17:41:00 +0000 (19:41 +0200)]
cmd: use safe number parsers in lxc-usernsexec

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocmd: simplify lxc-usernsexec
Christian Brauner [Sun, 19 Aug 2018 17:37:49 +0000 (19:37 +0200)]
cmd: simplify lxc-usernsexec

Calculate length only once.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocmd: use utils.{c,h} helpers in lxc-usernsexec
Christian Brauner [Sun, 19 Aug 2018 17:33:25 +0000 (19:33 +0200)]
cmd: use utils.{c,h} helpers in lxc-usernsexec

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocmd: move declarations to macro.h
Christian Brauner [Sun, 19 Aug 2018 17:32:38 +0000 (19:32 +0200)]
cmd: move declarations to macro.h

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocmd: lxc-usernsexec reorder includes
Christian Brauner [Sun, 19 Aug 2018 17:30:59 +0000 (19:30 +0200)]
cmd: lxc-usernsexec reorder includes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2548 from 2xsec/bugfix
Christian Brauner [Sun, 19 Aug 2018 10:03:27 +0000 (12:03 +0200)]
Merge pull request #2548 from 2xsec/bugfix

cmd: lxc-user-nic: change log macro & cleanups

6 years agocmd: lxc-user-nic: change log macro & cleanups
2xsec [Sun, 19 Aug 2018 03:45:54 +0000 (12:45 +0900)]
cmd: lxc-user-nic: change log macro & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agoMerge pull request #2547 from brauner/2018-08-18/fix_execute_parsing
Serge Hallyn [Sat, 18 Aug 2018 16:35:11 +0000 (11:35 -0500)]
Merge pull request #2547 from brauner/2018-08-18/fix_execute_parsing

tools: fix lxc-execute command parsing

6 years agoMerge pull request #2545 from ljagiello/integer-overflow
Christian Brauner [Sat, 18 Aug 2018 16:05:19 +0000 (18:05 +0200)]
Merge pull request #2545 from ljagiello/integer-overflow

storage/loop.c: integer overflow

6 years agolseek - integer overflow
Lukasz Jagiello [Sat, 18 Aug 2018 15:32:21 +0000 (08:32 -0700)]
lseek - integer overflow

The issue was introduced in PR (https://github.com/lxc/lxc/pull/1705):

Previous code:
```
  if (lseek(fd, size, SEEK_SET) < 0) {
    SYSERROR("Error seeking to set new loop file size");
    close(fd);
    return -1;
  }
```
New code:
```
  int fd, ret;

  [...]

  ret = lseek(fd, size, SEEK_SET);
  if (ret < 0) {
    SYSERROR("Failed to seek to set new loop file size for loop "
       "file \"%s\"", path);
    close(fd);
    return -1;
  }
```

Based on http://man7.org/linux/man-pages/man2/lseek.2.html:
> Upon successful completion, lseek() returns the resulting offset
> location as measured in bytes from the beginning of the file.

So in this case value of `size` and `size` is `uint64_t`.

This fix change declaration of `ret`, but it can be fixed in other ways.
Let me know what works for you.

This PR fix issues (https://github.com/lxc/lxc/issues/1872).

Signed-off-by: Lukasz Jagiello <lukasz@wikia-inc.com>
6 years agotools: fix lxc-execute command parsing
Christian Brauner [Sat, 18 Aug 2018 09:56:05 +0000 (11:56 +0200)]
tools: fix lxc-execute command parsing

Initialize buf to avoid parsing random data later on.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2546 from 2xsec/bugfix
Christian Brauner [Sat, 18 Aug 2018 09:46:10 +0000 (11:46 +0200)]
Merge pull request #2546 from 2xsec/bugfix

storage_utils: move duplicated function from tools

6 years agostorage_utils: move duplicated function from tools
2xsec [Sat, 18 Aug 2018 09:05:32 +0000 (18:05 +0900)]
storage_utils: move duplicated function from tools

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agoMerge pull request #2544 from 2xsec/bugfix
Christian Brauner [Sat, 18 Aug 2018 07:58:53 +0000 (09:58 +0200)]
Merge pull request #2544 from 2xsec/bugfix

tools: add default log priority & cleanups

6 years agotools: lxc-unfreeze: add default log priority & cleanups
2xsec [Fri, 17 Aug 2018 16:42:15 +0000 (01:42 +0900)]
tools: lxc-unfreeze: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agotools: lxc-freeze: add default log priority & cleanups
2xsec [Fri, 17 Aug 2018 16:41:51 +0000 (01:41 +0900)]
tools: lxc-freeze: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agotools: lxc-stop: add default log priority & cleanups
2xsec [Fri, 17 Aug 2018 16:41:06 +0000 (01:41 +0900)]
tools: lxc-stop: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agotools: lxc-start: add default log priority & cleanups
2xsec [Fri, 17 Aug 2018 16:40:29 +0000 (01:40 +0900)]
tools: lxc-start: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agotools: lxc-execute: add default log priority & cleanups
2xsec [Fri, 17 Aug 2018 16:39:20 +0000 (01:39 +0900)]
tools: lxc-execute: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agotools: lxc-device: add default log priority & cleanups
2xsec [Fri, 17 Aug 2018 16:38:13 +0000 (01:38 +0900)]
tools: lxc-device: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agotools: lxc-destroy: add default log priority & cleanups
2xsec [Fri, 17 Aug 2018 16:36:58 +0000 (01:36 +0900)]
tools: lxc-destroy: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agotools: lxc-create: add default log priority & cleanups
2xsec [Fri, 17 Aug 2018 16:35:57 +0000 (01:35 +0900)]
tools: lxc-create: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agotools: lxc-console: add default log priority & cleanups
2xsec [Fri, 17 Aug 2018 16:34:28 +0000 (01:34 +0900)]
tools: lxc-console: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agotools: lxc-checkpoint: add default log priority & cleanups
2xsec [Fri, 17 Aug 2018 16:33:37 +0000 (01:33 +0900)]
tools: lxc-checkpoint: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agotools: lxc-cgroup: add default log priority & cleanups
2xsec [Fri, 17 Aug 2018 16:31:54 +0000 (01:31 +0900)]
tools: lxc-cgroup: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agotools: lxc-attach: add default log priority & cleanups
2xsec [Fri, 17 Aug 2018 16:30:52 +0000 (01:30 +0900)]
tools: lxc-attach: add default log priority & cleanups

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agoMerge pull request #2543 from brauner/2018-08-17/silence_init_umount_failures
Stéphane Graber [Fri, 17 Aug 2018 14:48:33 +0000 (10:48 -0400)]
Merge pull request #2543 from brauner/2018-08-17/silence_init_umount_failures

lxc_init: s/SYSDEBUG()/SYSERROR()/g in remove_self

6 years agolxc_init: s/SYSDEBUG()/SYSERROR()/g in remove_self
Christian Brauner [Fri, 17 Aug 2018 09:47:25 +0000 (11:47 +0200)]
lxc_init: s/SYSDEBUG()/SYSERROR()/g in remove_self

Since we switched to execveat() whenever possible in
commit 4b5b3a2a299b ("execute: use execveat() syscall if supported")
it is unlikely that remove_self() has any job to do at all. So dumb down the
error levels.

Closes #2536.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2540 from tcharding/checkatch-cmd
Christian Brauner [Fri, 17 Aug 2018 09:41:27 +0000 (11:41 +0200)]
Merge pull request #2540 from tcharding/checkatch-cmd

cmd: Fix up checkpatch warnings

6 years agoMerge pull request #2539 from tcharding/contributing
Christian Brauner [Fri, 17 Aug 2018 09:27:22 +0000 (11:27 +0200)]
Merge pull request #2539 from tcharding/contributing

Clean up contributing and coding stlye docs

6 years agocmd: Do not use comparison to NULL
Tobin C. Harding [Fri, 17 Aug 2018 06:18:27 +0000 (16:18 +1000)]
cmd: Do not use comparison to NULL

checkpatch emits two warnings of type:

    CHECK: Comparison to NULL could be written "!foo"

Prefer `(!foo)` instead of `(foo == NULL)`.

Do not use comparison to NULL, use !foo

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agocmd: Remove typo'd semicolon
Tobin C. Harding [Fri, 17 Aug 2018 06:14:30 +0000 (16:14 +1000)]
cmd: Remove typo'd semicolon

checkpatch emits warning:

    WARNING: Statements terminations use 1 semicolon

Remove typo'd semicolon.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agocmd: Put trailing */ on a separate line
Tobin C. Harding [Fri, 17 Aug 2018 06:13:29 +0000 (16:13 +1000)]
cmd: Put trailing */ on a separate line

checkpatch emits warning:

    WARNING: Block comments use a trailing */ on a separate line

Put trailing */ on a separate line.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agocmd: Remove unnecessary whitespace in string
Tobin C. Harding [Fri, 17 Aug 2018 06:08:01 +0000 (16:08 +1000)]
cmd: Remove unnecessary whitespace in string

checkpatch emits warning:

    WARNING: unnecessary whitespace before a quoted newline

Remove unnecessary whitespace before a quoted newline

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agocmd: Use 'const' for static string constant.
Tobin C. Harding [Fri, 17 Aug 2018 06:05:14 +0000 (16:05 +1000)]
cmd: Use 'const' for static string constant.

checkpatch emits warning:

WARNING: static char array declaration should probably be static const char

Use 'const' for static string constant (array of chars).

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agocmd: Fix whitespace issues
Tobin C. Harding [Fri, 17 Aug 2018 06:02:28 +0000 (16:02 +1000)]
cmd: Fix whitespace issues

checkpatch warns about a bunch of whitespace issues.  Fix the
non-controversial ones.

Fix whitespace issues found by checkpatch.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agocmd: Do not use braces for single statement block
Tobin C. Harding [Fri, 17 Aug 2018 05:52:09 +0000 (15:52 +1000)]
cmd: Do not use braces for single statement block

checkpatch emites warning:

    WARNING: braces {} are not necessary for single statement blocks

Do not use braces for single statement block.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agocmd: Use 'void' instead of empty parameter list
Tobin C. Harding [Fri, 17 Aug 2018 05:44:25 +0000 (15:44 +1000)]
cmd: Use 'void' instead of empty parameter list

checkpatch warns because of function definitions using empty parameter
list.  We should define these functions with 'void' as the parameter.

Use 'void' instead of empty parameter list for function definitions.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agocmd: Use parenthesis around complex macro
Tobin C. Harding [Fri, 17 Aug 2018 05:42:32 +0000 (15:42 +1000)]
cmd: Use parenthesis around complex macro

checkpatch emits error:

    ERROR: Macros with complex values should be enclosed in parentheses

Safeguard macro by use of parenthesis.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agoCODING_STYLE: Update section header format
Tobin C. Harding [Fri, 17 Aug 2018 04:40:45 +0000 (14:40 +1000)]
CODING_STYLE: Update section header format

Currently for section headings we use fourth level markdown heading
level (####).  We do not have levels two or three.

We can use standard incremental levels for heading adornments i.e

1) =========
2) ##
3) ###
ect.

Since this document is likely referenced by maintainers when guiding new
contributors it can save maintainer time to be able to quickly reference
a section in the coding stlye guide.  If we add numbers to each heading
(like the kernel stlye guide) then maintainers can say:

   Nice patch, please see section 3 of the coding style guide and ...

So, this patch makes two changes

- Use incremental level heading adornments
- Add a number to each section heading

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agoCODING_STYLE: Fix non-uniform heading level
Tobin C. Harding [Fri, 17 Aug 2018 04:07:48 +0000 (14:07 +1000)]
CODING_STYLE: Fix non-uniform heading level

Heading uses only 3 level header (###) but the rest of the file uses
four (####).  We should be uniform.

Use uniform heading level in line with the rest of the file.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agoCODING_STLYE: Remove sections implied by 'kernel style'
Tobin C. Harding [Fri, 17 Aug 2018 03:55:47 +0000 (13:55 +1000)]
CODING_STLYE: Remove sections implied by 'kernel style'

We explicitly state that LXC uses coding style based on Linux kernel
style.  It is redundant to then document obvious, and well known, kernel
style rules.  Identifier names certainly fall into this category as does
usage of braces.

Remove sections implied by 'kernel style'.  Naming conventions and brace
placement conventions.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agoCODING_STLYE: Simplify explanation for use of 'extern'
Tobin C. Harding [Thu, 16 Aug 2018 23:38:48 +0000 (09:38 +1000)]
CODING_STLYE: Simplify explanation for use of 'extern'

Current explanation of rules around usage of 'extern' are overly
verbose.  It is not necessary to state that functions should be declared
in header files, the compiler already enforces this.  These rules are
simple, they are better described with simple statements.  An example is
not necessary for such simple rules and serves only to make the document
longer.

Use two simple statements describing the rules that govern function
declaration and the usage of the 'extern' keyword.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agoCONTRIBUTING: Add 'be' to fix grammar
Tobin C. Harding [Thu, 16 Aug 2018 23:22:40 +0000 (09:22 +1000)]
CONTRIBUTING: Add 'be' to fix grammar

Fix minor grammatical issue.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agoCODING_STYLE: Mention kernel style in introduction
Tobin C. Harding [Fri, 17 Aug 2018 03:46:16 +0000 (13:46 +1000)]
CODING_STYLE: Mention kernel style in introduction

Currently the coding style guide does not mention that we use kernel
coding style as a base style for LXC.  We have just linked to
CODING_STLYE.md from CONTRIBUTING (which mentions use of kernel coding
style).  We can increase documentation congruence and completeness by
mentioning kernel coding style guide in the introduction to our style
guide.

Add heading and introduction to coding style guide informing readers
that we follow kernel coding style as a base before explaining our style
additions.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agoCONTRIBUTING: Direct readers to CODING_STYLE.md
Tobin C. Harding [Thu, 16 Aug 2018 23:19:32 +0000 (09:19 +1000)]
CONTRIBUTING: Direct readers to CODING_STYLE.md

Currently the 'Coding Style' section mentions only the kernel coding
style.  We have additions on top on this outlined in CODING_STYLE.md.
We should direct readers to this document as well as the kernel docs.

Direct readers to CODING_STLYE.md in the 'Coding Style' section.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agoCONTRIBUTING: Link to latest online kernel docs
Tobin C. Harding [Fri, 17 Aug 2018 04:29:15 +0000 (14:29 +1000)]
CONTRIBUTING: Link to latest online kernel docs

Currently we link to a URL for v4.10 of the kernel docs.  Since we
already mention the kernel tree we should link to the _latest_ kernel
docs online instead of a fixed past version.

Link to latest online kernel docs tracking the mainline instead of past
fixed version.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agoCONTRIBUTING: Update reference to kernel coding style
Tobin C. Harding [Fri, 17 Aug 2018 04:16:47 +0000 (14:16 +1000)]
CONTRIBUTING: Update reference to kernel coding style

Kernel coding style guide filename is stale, this file has been renamed
in the kernel tree.  While this file still exists we should use the new
filename.

Update reference to kernel coding style guide to use the new file name.

Signed-off-by: Tobin C. Harding <me@tobin.cc>