| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
| |
Analyze all uses of 'int' in the code, and replace with 'size_t' where
appropriate.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously a lot of daemon code used three variables (a string list,
'int size' and 'int alloc') to track growable strings buffers. This
commit implements a simple struct containing the same variables, but
using size_t instead of int:
struct stringsbuf {
char **argv;
size_t size;
size_t alloc;
};
Use it like this:
DECLARE_STRINGSBUF (ret);
//...
if (add_string (&ret, str) == -1)
return NULL;
//...
if (end_stringsbuf (&ret) == -1)
return NULL;
return ret.argv;
|
| |
|
| |
|
| |
|
|
|
|
| |
This reverts commit 0eaf06e673833bc25673d5c3d2487fffae310285.
|
|
|
|
|
|
|
|
|
| |
Error: UNINIT:
/builddir/build/BUILD/libguestfs-1.16.5/daemon/glob.c:32: var_decl: Declaring variable "buf" without initializer.
/builddir/build/BUILD/libguestfs-1.16.5/daemon/glob.c:36: uninit_use_in_call: Using uninitialized value "buf.gl_offs" when calling "rpl_glob".
/builddir/build/BUILD/libguestfs-1.16.5/gnulib/lib/glob.c:557: read_parm_fld: Reading a parameter field.
/builddir/build/BUILD/libguestfs-1.16.5/daemon/glob.c:36: uninit_use_in_call: Using uninitialized value "buf.gl_pathc" when calling "rpl_glob".
/builddir/build/BUILD/libguestfs-1.16.5/gnulib/lib/glob.c:557: read_parm_fld: Reading a parameter field.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The Coverity error is this (which I think is wrong):
Error: TAINTED_SCALAR:
/builddir/build/BUILD/libguestfs-1.16.5/daemon/inotify.c:211: tainted_data_argument: Calling function "read" taints argument "inotify_buf".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/inotify.c:232: var_assign_var: Assigning: "event" = "(struct inotify_event *)&inotify_buf[n]". Both are now tainted.
/builddir/build/BUILD/libguestfs-1.16.5/daemon/inotify.c:258: lower_bounds: Checking lower bounds of unsigned scalar "event->len" by "event->len > 0U".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/inotify.c:272: var_assign_var: Compound assignment involving tainted variable "16UL + event->len" to variable "n" taints "n".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/inotify.c:228: lower_bounds: Checking lower bounds of unsigned scalar "n" by "n < inotify_posn".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/inotify.c:281: tainted_data: Using tainted variable "n" as an index into an array "inotify_buf".
Adding a sanity check of event->len is prudent.
|
|
|
|
|
|
|
|
| |
Error: RESOURCE_LEAK:
/builddir/build/BUILD/libguestfs-1.16.5/daemon/debug.c:469: open_fn: Calling opening function "open".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/debug.c:469: var_assign: Assigning: "fd" = handle returned from "open("/proc/sys/kernel/core_pattern", 1)".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/debug.c:474: noescape: Variable "fd" is not closed or saved in function "write".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/debug.c:476: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
|
|
|
|
|
|
|
|
| |
Error: RESOURCE_LEAK:
/builddir/build/BUILD/libguestfs-1.16.5/daemon/upload.c:225: open_fn: Calling opening function "open".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/upload.c:225: var_assign: Assigning: "fd" = handle returned from "open(filename, 0)".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/upload.c:233: noescape: Variable "fd" is not closed or saved in function "lseek".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/upload.c:235: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
|
|
|
|
|
|
|
|
|
| |
Error: RESOURCE_LEAK:
/builddir/build/BUILD/libguestfs-1.16.5/daemon/9p.c:130: open_fn: Calling opening function "open".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/9p.c:130: var_assign: Assigning: "fd" = handle returned from "open(filename, 0)".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/9p.c:142: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
/builddir/build/BUILD/libguestfs-1.16.5/daemon/9p.c:149: noescape: Variable "fd" is not closed or saved in function "read".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/9p.c:153: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
|
|
|
|
|
|
| |
Currently only ext2/3/4 and (newly) NTFS are supported.
This change also deprecates set-e2label.
|
| |
|
|
|
|
| |
Note this is not a "chkdsk" equivalent tool.
|
|
|
|
|
|
|
|
|
|
|
|
| |
(RHBZ#789960).
In the case where the caller attempts to mount the "hidden"
appliance root device (eg. /dev/vdb if /dev/vda is the only
normal block device added), we were calling reply_with_error
but not actually returning immediately, resulting in protocol
desynchronization.
This commit fixes this obvious mistake.
|
|
|
|
| |
This fixes commit a2b3e0900ee14e5a49d526c24e22edefc3030f99.
|
|
|
|
|
|
|
| |
Add the new api wipefs to erase the filesystem signatures
on a device but now erase any data.
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
|
| |
|
|
|
|
|
| |
See this util-linux commit:
https://github.com/karelzak/util-linux/commit/b82590ad46acf9fe8d332b53875e24c3c31e2482
|
|
|
|
|
|
|
| |
See comments in the code for details.
This is an alternate fix to
commit a9c8123c72db47bcab8dd738e8d5256a9ae87f11.
|
|
|
|
| |
This reverts commit a9c8123c72db47bcab8dd738e8d5256a9ae87f11.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Callers are supposed to use the availability API to check for
functions that may not be available in particular builds of
libguestfs. If they don't do this, currently they tend to get obscure
error messages, eg:
libguestfs: error: zerofree: /dev/vda1: zerofree: No such file or directory
This commit changes the error message to explain what callers ought to
be doing instead:
libguestfs: error: zerofree: feature 'zerofree' is not available in this
build of libguestfs. Read 'AVAILABILITY' in the guestfs(3) man page for
how to check for the availability of features.
This patch makes the stubs check for availability. The stub code
changes to:
static void
zerofree_stub (XDR *xdr_in)
{
[...]
/* The caller should have checked before calling this. */
if (! optgroup_zerofree_available ()) {
reply_with_error ("feature '%s' is not available in this\n"
"build of libguestfs. Read 'AVAILABILITY' in the guestfs(3) man page for\n"
"how to check for the availability of features.",
"zerofree");
goto done;
}
[...]
|
| |
|
|
|
|
|
|
|
|
|
| |
This commit tidies up the code by splitting out the path
element-searching code into a separate function.
Valgrind found that 'closedir' frees the 'struct dirent *', which
wasn't immediately obvious. So now we do the 'closedir' after all
operations which touch 'd->d_name'.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
This is just a code clean-up with no functional change.
|
| |
|
|
|
|
| |
This is just a code clean-up with no functional change.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
This uninitialized data was also sent over the protocol,
potentially being a serious information leak.
|
| |
|
|
|
|
|
|
| |
Fix the existing test to work correctly in this case.
Other cleanups.
|
|
|
|
| |
This is just code motion.
|
|
|
|
|
|
|
| |
When you call close on any block device, udev kicks off a rule which
runs blkid to reexamine the device. We need to wait for this rule to
finish running since it holds the device open and can cause other
operations to fail, notably BLKRRPART.
|
|
|
|
|
| |
In Linux, close (fd) closes the file descriptor even if it returns an
error.
|
|
|
|
| |
Update all copyright dates to 2012.
|
| |
|
|
|
|
|
|
|
|
| |
Since we implement the new api e2fsck, just change the
internal of e2fsck_f to use e2fsck now.
v1->v2: use optargs_bitmask
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
m: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Add a new api e2fsck with two options:
correct: same as '-p' option of e2fsck
forceall: same as '-y' option of e2fsck
Thanks for Rich's idea.
v1->v2: use optargs_bitmask
v2->v3: change the optargs_bitmask check
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
|
|
|
|
|
|
|
| |
Tweak the error message "e2fsck -f" and "e2fsck -fy".
Indicate the user to use the correct and/or forceall options.
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
v1->v2: fix a typo pointed by Matt
Optimizations by reducing the STREQ operations and do some
code cleanup.
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
RWMJ: Whitespace changes.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This also adds comprehensive tests for utimens on regular files,
directories (RHBZ#761451), named pipes (RHBZ#761460), symbolic links,
block and char devices.
Note that there is a small change in the (previously undefined)
semantics of this call: It now sets the time on a symbolic link
itself, not on what the symbolic link points to.
|