summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Use O_CLOEXEC / SOCK_CLOEXEC for almost all file descriptors.Richard W.M. Jones2012-03-146-11/+19
| | | | | | | | | | | | | | | | | | | | | | | | The presumption is that all file descriptors should be created with the close-on-exec flag set. The only exception are file descriptors that we want passed through to exec'd subprocesses (mainly pipes and stdin/stdout/stderr). For open calls, we pass O_CLOEXEC as an extra flag, eg: fd = open ("foo", O_RDONLY|O_CLOEXEC); This is a Linux-ism, but using a macro we can easily make it portable. For sockets, similarly: sock = socket (..., SOCK_STREAM|SOCK_CLOEXEC, ...); For accepted sockets, we use the Linux accept4 system call which allows flags to be supplied, but we use the Gnulib 'accept4' module to make this portable. For dup, dup2, we use the Linux dup3 system call, and the Gnulib modules 'dup3' and 'cloexec'.
* Replace 'int' with 'size_t' passim.Richard W.M. Jones2012-03-131-1/+1
| | | | | Analyze all uses of 'int' in the code, and replace with 'size_t' where appropriate.
* Fix strict-overflow bugs and reenable this warning.Richard W.M. Jones2012-03-121-3/+3
| | | | | | | | In two places, we were counting things in an array using an 'int'. In theory, the int could overflow, so gcc determines this to be undefined behaviour. The fix is to use size_t or ssize_t instead.
* inspect: Move variable decl to top of function.Richard W.M. Jones2012-03-121-1/+3
|
* inspect: Use 1/0 instead of true/false, and fix a bug in UUID parsing.Richard W.M. Jones2012-03-121-9/+13
| | | | | UUID parsing returned 'false' (ie. 0 == OK) when the UUID contained illegal characters. Now it returns -1 == failure.
* lib: Remove some unused variables.Richard W.M. Jones2012-03-124-7/+1
|
* lib: Use size_t instead of int for array iterator.Richard W.M. Jones2012-03-121-1/+1
|
* inspect: Use uint64_t for maximum file size in bytes.Richard W.M. Jones2012-03-122-3/+3
|
* lib: Use size_t for allocation size in safe realloc function.Richard W.M. Jones2012-03-122-2/+2
|
* Coalesce printable characters in debug and trace messages (RHBZ#802109).Richard W.M. Jones2012-03-111-8/+17
|
* Document error message from resize2fs (RHBZ#755729, RHBZ#801640).Richard W.M. Jones2012-03-091-0/+26
|
* Close all file descriptors and remove all signal handlers in the recovery ↵Richard W.M. Jones2012-03-091-0/+25
| | | | | | | | | | | | | | | | | process. If the parent process uses a pipe (or any fd, but pipes are a particular problem), then the recovery process would hold open the file descriptor(s) of the pipe, meaning that it could not be fully closed in the parent. Because the recovery process doesn't use exec(2), this wasn't avoidable even using FD_CLOEXEC. Avoid this by closing all file descriptors when starting the recovery process. After discussion with Dan Berrange, he points out that it's also a good idea to set signal handlers to the default after forking, so that any signal handlers set up in the parent don't affect the child.
* inspect_apps: Avoid double-close on error path (found by Coverity) ↵Richard W.M. Jones2012-03-081-0/+1
| | | | | | | | (RHBZ#801298). Error: USE_AFTER_FREE: /builddir/build/BUILD/libguestfs-1.16.5/src/inspect_apps.c:392: freed_arg: "fclose" frees "fp". /builddir/build/BUILD/libguestfs-1.16.5/src/inspect_apps.c:404: deref_arg: Calling "fclose" dereferences freed pointer "fp".
* dbdump: Avoid double-close on error path (found by Coverity).Richard W.M. Jones2012-03-081-0/+1
| | | | | | Error: USE_AFTER_FREE: /builddir/build/BUILD/libguestfs-1.16.5/src/dbdump.c:132: freed_arg: "pclose" frees "pp". /builddir/build/BUILD/libguestfs-1.16.5/src/dbdump.c:142: deref_arg: Calling "pclose" dereferences freed pointer "pp".
* daemon: proto: Close fd along error paths (found by Coverity).Richard W.M. Jones2012-03-081-0/+3
| | | | | | | | | Error: RESOURCE_LEAK: /builddir/build/BUILD/libguestfs-1.16.5/src/proto.c:894: open_fn: Calling opening function "open". /builddir/build/BUILD/libguestfs-1.16.5/src/proto.c:894: var_assign: Assigning: "fd" = handle returned from "open(filename, 0)". /builddir/build/BUILD/libguestfs-1.16.5/src/proto.c:903: noescape: Variable "fd" is not closed or saved in function "read". /builddir/build/BUILD/libguestfs-1.16.5/src/proto.c:911: leaked_handle: Handle variable "fd" going out of scope leaks the handle. /builddir/build/BUILD/libguestfs-1.16.5/src/proto.c:918: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
* proto: Close file along error and cancel paths (found by Coverity).Richard W.M. Jones2012-03-081-1/+5
| | | | | | | | | Error: RESOURCE_LEAK: /builddir/build/BUILD/libguestfs-1.16.5/src/proto.c:1125: open_fn: Calling opening function "open". /builddir/build/BUILD/libguestfs-1.16.5/src/proto.c:1125: var_assign: Assigning: "fd" = handle returned from "open(filename, 833, 438)". /builddir/build/BUILD/libguestfs-1.16.5/src/proto.c:1133: noescape: Variable "fd" is not closed or saved in function "xwrite". /builddir/build/BUILD/libguestfs-1.16.5/src/proto.c:1146: leaked_handle: Handle variable "fd" going out of scope leaks the handle. /builddir/build/BUILD/libguestfs-1.16.5/src/proto.c:1173: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
* Check return values from calloc (found by Coverity).Richard W.M. Jones2012-03-081-25/+29
| | | | | | | | | | | Error: NULL_RETURNS: /builddir/build/BUILD/libguestfs-1.16.5/src/inspect.c:417: returned_null: Function "calloc" returns null (checked 67 out of 81 times). /builddir/build/BUILD/libguestfs-1.16.5/src/inspect.c:417: var_assigned: Assigning: "ret" = null return value from "calloc". /builddir/build/BUILD/libguestfs-1.16.5/src/inspect.c:418: dereference: Dereferencing a null pointer "ret". [...] /builddir/build/BUILD/libguestfs-1.16.5/src/inspect.c:374: returned_null: Function "calloc" returns null (checked 67 out of 81 times). /builddir/build/BUILD/libguestfs-1.16.5/src/inspect.c:374: var_assigned: Assigning: "ret" = null return value from "calloc". /builddir/build/BUILD/libguestfs-1.16.5/src/inspect.c:375: dereference: Dereferencing a null pointer "ret".
* Dead code: 'lvs' cannot be true here (found by Coverity).Richard W.M. Jones2012-03-081-1/+1
| | | | | | | | | | | | | Remove dead code; however only comment it out since if we change the preceeding code we may need this line again. Error: DEADCODE: /builddir/build/BUILD/libguestfs-1.16.5/src/listfs.c:107: dead_error_condition: On this path, the condition "lvs" cannot be true. /builddir/build/BUILD/libguestfs-1.16.5/src/listfs.c:54: const: After this line, the value of "lvs" is equal to 0. /builddir/build/BUILD/libguestfs-1.16.5/src/listfs.c:91: const: After this line, the value of "lvs" is equal to 0. /builddir/build/BUILD/libguestfs-1.16.5/src/listfs.c:54: assignment: Assigning: "lvs" = "NULL". /builddir/build/BUILD/libguestfs-1.16.5/src/listfs.c:91: new_values: Noticing condition "lvs == NULL". /builddir/build/BUILD/libguestfs-1.16.5/src/listfs.c:107: dead_error_line: Execution cannot reach this statement "guestfs___free_string_list(...".
* Ignore return values from some functions in guestfs_close (Coverity warning).Richard W.M. Jones2012-03-081-2/+3
| | | | | | | | | | | | | | | | Error: CHECKED_RETURN: /builddir/build/BUILD/libguestfs-1.16.5/java/com_redhat_et_libguestfs_GuestFS.c:9552: example_assign: Assigning: "r" = return value from "guestfs_internal_autosync(g)". /builddir/build/BUILD/libguestfs-1.16.5/java/com_redhat_et_libguestfs_GuestFS.c:9555: example_checked: "r" has its value checked in "r == -1". /builddir/build/BUILD/libguestfs-1.16.5/ocaml/guestfs_c_actions.c:5584: example_assign: Assigning: "r" = return value from "guestfs_internal_autosync(g)". /builddir/build/BUILD/libguestfs-1.16.5/ocaml/guestfs_c_actions.c:5586: example_checked: "r" has its value checked in "r == -1". /builddir/build/BUILD/libguestfs-1.16.5/perl/Guestfs.xs:5990: example_assign: Assigning: "r" = return value from "guestfs_internal_autosync(g)". /builddir/build/BUILD/libguestfs-1.16.5/perl/Guestfs.xs:5991: example_checked: "r" has its value checked in "r == -1". /builddir/build/BUILD/libguestfs-1.16.5/python/guestfs-py.c:13702: example_assign: Assigning: "r" = return value from "guestfs_internal_autosync(g)". /builddir/build/BUILD/libguestfs-1.16.5/python/guestfs-py.c:13707: example_checked: "r" has its value checked in "r == -1". /builddir/build/BUILD/libguestfs-1.16.5/ruby/ext/guestfs/_guestfs.c:16000: example_assign: Assigning: "r" = return value from "guestfs_internal_autosync(g)". /builddir/build/BUILD/libguestfs-1.16.5/ruby/ext/guestfs/_guestfs.c:16001: example_checked: "r" has its value checked in "r == -1". /builddir/build/BUILD/libguestfs-1.16.5/src/guestfs.c:191: check_return: Calling function "guestfs_internal_autosync" without checking return value (as is done elsewhere 5 out of 6 times). /builddir/build/BUILD/libguestfs-1.16.5/src/guestfs.c:191: unchecked_value: No check of the return value of "guestfs_internal_autosync(g)".
* Update API support.Richard W.M. Jones2012-03-0723-0/+10581
|
* inspection: Add detection of FreeDOS install CDs (RHBZ#786188).Richard W.M. Jones2012-03-072-2/+13
|
* inspection: Add detection of FreeDOS (RHBZ#786215).Richard W.M. Jones2012-03-076-0/+24
| | | | | FreeDOS is returned as type="dos", distro="freedos". No version or application information is returned at present.
* Comment change.Richard W.M. Jones2012-03-071-1/+1
|
* Hide stderr of bmptopng.Richard W.M. Jones2012-03-071-2/+3
| | | | This program is noisy on stderr. Send that to /dev/null.
* build: Make netpbm and icoutils into proper optional dependencies.Richard W.M. Jones2012-03-071-5/+30
| | | | | | | | Netpbm and icoutils (wrestool) have always been dependencies. Since they are not always present, make these into optional dependencies (which they were, sort of, before). Also document these dependencies in the README file.
* Add support for Buildroot and Cirros distributions.Richard W.M. Jones2012-03-075-0/+84
|
* Whitespace change.Richard W.M. Jones2012-03-071-1/+1
|
* Add a 'fixed' style of appliance.Richard W.M. Jones2012-03-031-3/+33
| | | | | | | | | | This is just the 'kernel', 'initrd' and 'root' files, copied from one machine to another, along with a 'README.fixed' file which is also used for identification. This allows the appliance to be copied from one machine to another, making it easier for us to distribute a starter appliance for people who cannot get febootstrap or appliance-building working.
* Rebrand 'ordinary appliance' as 'old-style appliance'.Richard W.M. Jones2012-03-032-8/+8
| | | | This is just code motion.
* New API: set-label, for setting a label on any filesystem.Richard W.M. Jones2012-02-271-1/+1
| | | | | | Currently only ext2/3/4 and (newly) NTFS are supported. This change also deprecates set-e2label.
* New APIs: ntfsclone-in, ntfsclone-out.Richard W.M. Jones2012-02-271-1/+1
|
* New API: ntfsfix for fixing problems on NTFS.Richard W.M. Jones2012-02-271-1/+1
| | | | Note this is not a "chkdsk" equivalent tool.
* set-smp: limit the number of cpus below 255Wanlong Gao2012-02-251-1/+4
| | | | | | Limit the number of cpus below 255, since qemu can't support. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
* appliance: Make appliance building thread-safe (RHBZ#790721).Richard W.M. Jones2012-02-151-1/+12
| | | | | | | | | | | | | | | Appliance building can be called from multiple processes, but this is only safe if each process holds a lock on the 'checksum' file. However threads within a process are not excluded by a file lock, and so this strategy completely failed for a multithreaded program calling guestfs_launch in parallel. Since it makes no sense for threads in a single program to race each other to try to create the appliance, add a lock around appliance building. This serialises building the appliance, but the rest of guestfs_launch (eg. starting up qemu) can run in parallel.
* NEW API: add a new api wipefsWanlong Gao2012-02-101-1/+1
| | | | | | | 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>
* docs: Note that JRuby should use the Java bindings.Richard W.M. Jones2012-02-091-0/+2
|
* New API: llz: This runs ls -laZ and is useful for showing SELinux contexts.Richard W.M. Jones2012-02-091-1/+1
|
* Enable running the daemon under valgrind.Richard W.M. Jones2012-01-242-0/+18
| | | | | | | | | | | | | | | | | This commit allows you to run the daemon under valgrind. You have to enable it at configure time: ./configure --enable-valgrind-daemon This should *not* be done for production builds. When this feature is enabled, valgrind is added to the appliance and the daemon is run under valgrind. Log messages from valgrind are passed back over a virtio-serial channel into a file called 'valgrind.log.$PID' in the top build directory. Running 'make check', 'make extra-tests' etc causes many valgrind.log.* files to be created which must be examined by hand.
* API support: Fix src/api-support/added file.Richard W.M. Jones2012-01-231-470/+470
| | | | This fixes commit 37e07db1598b433c12ee643302712d81b2c5415d.
* Update API support.Richard W.M. Jones2012-01-2324-474/+11234
|
* gobject: Document these bindings in guestfs(3).Richard W.M. Jones2012-01-221-0/+7
|
* Tempus fugit.Richard W.M. Jones2012-01-1814-14/+14
| | | | Update all copyright dates to 2012.
* lib: Use -fvisibilty=hidden by default; only ABI symbols are now visible.Richard W.M. Jones2012-01-181-3/+5
| | | | http://gcc.gnu.org/wiki/Visibility
* New tool: virt-format: erase and make blank disks.Richard W.M. Jones2012-01-181-0/+5
| | | | | This tool allows you to easily reformat a disk, creating a blank disk with optional partition, LVM and empty filesystem.
* NEW API: add a new api e2fsckWanlong Gao2012-01-131-1/+1
| | | | | | | | | | | | | | 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>
* Allow /dev/null to be added multiple times.Richard W.M. Jones2012-01-101-1/+8
| | | | | | | | Change the test for duplicate drives so that you're allowed to add /dev/null multiple times. This corresponds to traditional usage. This amends commit be47b66c3033105a2b880dbc10bfc2b163b7eafe.
* launch: move the filename checking to a wrapperWanlong Gao2012-01-091-6/+12
| | | | | | Move the filename's comma character checking to a wrapper. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
* launch: don't add a drive twiceWanlong Gao2012-01-091-2/+12
| | | | | | | | | | | | | | 1. Change the g->path to restore a absolute path instead of the mixed. 2. Check that if the adding drive is duplicated with the added drive. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> RWMJ: - Make sure abs_path is NULL before it is assigned, so freeing it will work along the error path. - Fix the test which added /dev/null multiple times.
* launch: add a goto label when add_drive errorWanlong Gao2012-01-091-18/+11
| | | | | | | Code cleanup. Add a goto label to simplify the code. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
* lib: Try harder to remove temporary directory along error paths (RHBZ#769680).Richard W.M. Jones2011-12-231-1/+11
|