Commit Graph

7627 Commits

Author SHA1 Message Date
Christian Brauner
87a70c5703
Merge pull request #2550 from 2xsec/bugfix
storage: exit() => _exit()
2018-08-20 12:34:15 +02:00
Christian Brauner
de206187cd
Merge pull request #2542 from tcharding/signal-fail-2523
tools: Indicate container startup failure
2018-08-20 12:33:45 +02:00
Christian Brauner
4f9500b1a5
Merge pull request #2553 from Blub/ttydir-path-fixup
conf: fix path/lxcpath mixups in tty setup
2018-08-20 10:37:50 +02:00
Wolfgang Bumiller
adc1c7156c 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")
2018-08-20 10:07:08 +02:00
2xsec
75457df5dc
tools: lxc-wait: add default log priority & cleanups
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-08-20 10:43:22 +09:00
2xsec
2c70300ad8
storage: exit() => _exit(). when exec is failed, child process needs to use _exit()
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-08-20 10:41:50 +09:00
Tobin C. Harding
e3e70db364 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>
2018-08-20 09:00:14 +10:00
Christian Brauner
7b15813c33
macro: add macvlan properties
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-19 20:27:46 +02:00
Christian Brauner
85de58d6e3
macro: add missing headers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-19 20:27:45 +02:00
Christian Brauner
d3b413e7d5
cmd: use safe number parsers in lxc-usernsexec
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-19 20:27:45 +02:00
Christian Brauner
5ff0284480
cmd: simplify lxc-usernsexec
Calculate length only once.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-19 20:27:45 +02:00
Christian Brauner
197c9293a6
cmd: use utils.{c,h} helpers in lxc-usernsexec
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-19 20:27:45 +02:00
Christian Brauner
c881c8101b
cmd: move declarations to macro.h
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-19 20:27:45 +02:00
Christian Brauner
72a506941f
cmd: lxc-usernsexec reorder includes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-19 20:27:43 +02:00
Christian Brauner
89a9f3933b
Merge pull request #2548 from 2xsec/bugfix
cmd: lxc-user-nic: change log macro & cleanups
2018-08-19 12:03:27 +02:00
2xsec
3725a69c38 cmd: lxc-user-nic: change log macro & cleanups
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-08-19 12:45:54 +09:00
Serge Hallyn
59c018f20b
Merge pull request #2547 from brauner/2018-08-18/fix_execute_parsing
tools: fix lxc-execute command parsing
2018-08-18 11:35:11 -05:00
Christian Brauner
0a4f0d02d8
Merge pull request #2545 from ljagiello/integer-overflow
storage/loop.c: integer overflow
2018-08-18 18:05:19 +02:00
Lukasz Jagiello
8737e2a8a5
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>
2018-08-18 08:32:21 -07:00
Christian Brauner
0044aab02a
tools: fix lxc-execute command parsing
Initialize buf to avoid parsing random data later on.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-18 11:56:05 +02:00
Christian Brauner
2957be64da
Merge pull request #2546 from 2xsec/bugfix
storage_utils: move duplicated function from tools
2018-08-18 11:46:10 +02:00
2xsec
2b670dfeb0 storage_utils: move duplicated function from tools
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-08-18 18:05:32 +09:00
Christian Brauner
826a94a587
Merge pull request #2544 from 2xsec/bugfix
tools: add default log priority & cleanups
2018-08-18 09:58:53 +02:00
2xsec
34a10bfa34 tools: lxc-unfreeze: add default log priority & cleanups
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-08-18 01:42:15 +09:00
2xsec
fe8c37efdb tools: lxc-freeze: add default log priority & cleanups
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-08-18 01:41:51 +09:00
2xsec
c2a23ef6e4 tools: lxc-stop: add default log priority & cleanups
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-08-18 01:41:06 +09:00
2xsec
c7013c1303 tools: lxc-start: add default log priority & cleanups
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-08-18 01:40:29 +09:00
2xsec
e8c0bb81d3 tools: lxc-execute: add default log priority & cleanups
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-08-18 01:39:20 +09:00
2xsec
9fe1638742 tools: lxc-device: add default log priority & cleanups
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-08-18 01:38:13 +09:00
2xsec
a53759568a tools: lxc-destroy: add default log priority & cleanups
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-08-18 01:36:58 +09:00
2xsec
0e9dc035dd tools: lxc-create: add default log priority & cleanups
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-08-18 01:35:57 +09:00
2xsec
a291ab7859 tools: lxc-console: add default log priority & cleanups
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-08-18 01:34:28 +09:00
2xsec
c03b298128 tools: lxc-checkpoint: add default log priority & cleanups
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-08-18 01:33:37 +09:00
2xsec
62ebeb04ef tools: lxc-cgroup: add default log priority & cleanups
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-08-18 01:31:54 +09:00
2xsec
81b4606580 tools: lxc-attach: add default log priority & cleanups
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-08-18 01:30:52 +09:00
Stéphane Graber
5493a1bf89
Merge pull request #2543 from brauner/2018-08-17/silence_init_umount_failures
lxc_init: s/SYSDEBUG()/SYSERROR()/g in remove_self
2018-08-17 10:48:33 -04:00
Christian Brauner
694756df3a
lxc_init: s/SYSDEBUG()/SYSERROR()/g in remove_self
Since we switched to execveat() whenever possible in
commit 4b5b3a2a29 ("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>
2018-08-17 11:47:25 +02:00
Christian Brauner
3278fdc26c
Merge pull request #2540 from tcharding/checkatch-cmd
cmd: Fix up checkpatch warnings
2018-08-17 11:41:27 +02:00
Christian Brauner
5246e140b8
Merge pull request #2539 from tcharding/contributing
Clean up contributing and coding stlye docs
2018-08-17 11:27:22 +02:00
Tobin C. Harding
551865932e 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>
2018-08-17 16:18:27 +10:00
Tobin C. Harding
2115d56671 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>
2018-08-17 16:14:30 +10:00
Tobin C. Harding
75ca3dc6aa 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>
2018-08-17 16:14:06 +10:00
Tobin C. Harding
1d9f2743b2 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>
2018-08-17 16:10:08 +10:00
Tobin C. Harding
7f5700e6aa 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>
2018-08-17 16:10:08 +10:00
Tobin C. Harding
32cf169fab 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>
2018-08-17 16:10:03 +10:00
Tobin C. Harding
24d6fb8a27 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>
2018-08-17 15:52:09 +10:00
Tobin C. Harding
2b360805d0 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>
2018-08-17 15:44:25 +10:00
Tobin C. Harding
e8fcdf3db2 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>
2018-08-17 15:42:32 +10:00
Tobin C. Harding
7419c83f44 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>
2018-08-17 14:54:35 +10:00
Tobin C. Harding
efcb7f361b 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>
2018-08-17 14:37:15 +10:00