summaryrefslogtreecommitdiffstats
path: root/daemon
Commit message (Collapse)AuthorAgeFilesLines
* fish/mount: Add better error message when -m (mount) fails (RHBZ#824043).Richard W.M. Jones2012-06-011-1/+2
| | | | (cherry picked from commit ee9ab52bc3e087f63dcc51d3b6ac5c79277425e1)
* doc: Add notes on how GPT works on 4k sector disks.Richard W.M. Jones2012-05-181-1/+3
| | | | | | | | | | I used scsi_debug to create a 4k sector virtual disk: modprobe scsi_debug dev_size_mb=128 sector_size=4096 I then used 'gdisk' to create lots of partitions, and used 'hexdump' to examine what was written to disk. (cherry picked from commit 2fd2c85f6a42575749b9d38bd2f1512ae25db760)
* debug: 'progress' (unsupported debug command) now checks argument is ↵Richard W.M. Jones2012-05-011-1/+5
| | | | | | | reasonable (RHBZ#816839). Thanks Yuyu Zhou. (cherry picked from commit cc798540370658ecc1bba94c4ab4b64485c9bcc6)
* mkfs: Don't allow blocksize to be set on btrfs (RHBZ#807905).Richard W.M. Jones2012-04-021-0/+5
| | | | (cherry picked from commit 77ac6b73cde017452d48d53aaf6fa755502b05d5)
* daemon: Add reply_with_error_errno function.Richard W.M. Jones2012-03-212-6/+7
| | | | | | | This function allows you to pass an explicit errno back to the library. reply_with_error is redefined as a macro that calls reply_with_error_errno with errno == 0. (cherry picked from commit 7526df547c5bea9a0cb4370ca022e413388dce2e)
* daemon: Don't call reply_with_* after split_lines fails.Richard W.M. Jones2012-03-162-6/+2
| | | | | | split_lines already sets reply_with_*, so calling it again would lose protocol synchronization. (cherry picked from commit 710ec49bac8bce10bfc0b9ba4b34d877c22f7287)
* daemon: When copy subprocess fails, print return code.Richard W.M. Jones2012-03-141-1/+1
| | | | | Useful for debugging. (cherry picked from commit 5da61d30520315a7d5060137a6c109f2109a7631)
* daemon: Remove unused variables.Richard W.M. Jones2012-03-132-8/+0
| | | | (cherry picked from commit 13c2db39abff3c0050eade5bcce997afdf04d721)
* e2fsck: Comment, whitespace, error message cleanups.Richard W.M. Jones2012-03-131-2/+2
| | | | (cherry picked from commit 4c9218658e4d4b769acaa41d999b4bce437fbc37)
* daemon: glob: Initialize glob buffer (quiet Coverity warning).Richard W.M. Jones2012-03-081-1/+1
| | | | | | | | | | 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. (cherry picked from commit b2c1d8be39d4689267ef7e4188e2cf936b30628f)
* comment: Note time-of-check to time-of-use race found by Coverity.Richard W.M. Jones2012-03-081-0/+6
| | | | (cherry picked from commit 3345444cccfe2e2fb07d4769d1e764eca59dd6f9)
* daemon: inotify: Check event->len in inotify struct is reasonable.Richard W.M. Jones2012-03-081-0/+7
| | | | | | | | | | | | | | | 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. (cherry picked from commit ae0f9f149b2b527b924d4532aa38302056d8a6b0)
* daemon: debug: Close fd along error path (found by Coverity).Richard W.M. Jones2012-03-081-0/+1
| | | | | | | | | 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. (cherry picked from commit 3b3d9ca4e1fa0a4f566cb2a8008540ee640b738b)
* daemon: upload: Close fd along error path (found by Coverity).Richard W.M. Jones2012-03-081-0/+1
| | | | | | | | | 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. (cherry picked from commit fbf10d7f682178a6a71cfa8dbac2acd23f869597)
* daemon: 9p: Close fd along error paths (found by Coverity).Richard W.M. Jones2012-03-081-0/+2
| | | | | | | | | | 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. (cherry picked from commit cba36e730524525b5fc1c0df2ec3dd878d55ff15)
* daemon: Return error properly when user tries to mount appliance root ↵Richard W.M. Jones2012-02-131-1/+4
| | | | | | | | | | | | | (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. (cherry picked from commit 07081591cf9928454148db84828da8a7f39b6c6f)
* findfs: Remove /run/blkid/blkid.tab.Richard W.M. Jones2012-02-081-0/+1
| | | | | | See this util-linux commit: https://github.com/karelzak/util-linux/commit/b82590ad46acf9fe8d332b53875e24c3c31e2482 (cherry picked from commit f504cb02e1e8ef394287ddbaaad2fb1ec04bc33f)
* blockdev, parted: Call udev_settle before and after commands. (RHBZ#769304)Richard W.M. Jones2012-02-082-52/+115
| | | | | | | | See comments in the code for details. This is an alternate fix to commit a9c8123c72db47bcab8dd738e8d5256a9ae87f11. (cherry picked from commit 21a9efcad5379cbfcc2404142472ec5efda4aaa0)
* Revert "daemon: Run udev_settle after pwrite-device finishes."Richard W.M. Jones2012-02-082-17/+4
| | | | | This reverts commit a9c8123c72db47bcab8dd738e8d5256a9ae87f11. (cherry picked from commit a98170e0e255021481cd428ee12d0858a59a875b)
* Clarify the error message when unavailable functions are called (RHBZ#679737).Richard W.M. Jones2012-02-027-134/+249
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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; } [...] (cherry picked from commit 330fbea5b2d6bd7db84f7ea7afe87cf1bcd438e0)
* daemon: Fix crash in aug-defnode (RHBZ#785668).Richard W.M. Jones2012-01-301-6/+15
| | | | (cherry picked from commit e3f15780c8197a66bfb620b802ba18d0ba0dd2ce)
* daemon: Fix use-after-free in case-insensitive-path (found by valgrind).Richard W.M. Jones2012-01-241-38/+81
| | | | | | | | | | 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'. (cherry picked from commit a05ddcd2a719f97ba036e9d6ca4e6491ed8b1fd0)
* daemon: Fix leaking error message (found by valgrind).Richard W.M. Jones2012-01-241-0/+1
| | | | (cherry picked from commit 9700708a19a46a61ffe53c6e648206336781477e)
* daemon: Close inotify handle on exit.Richard W.M. Jones2012-01-241-0/+11
| | | | (cherry picked from commit 86f64c37b914645afb345f96af13ad843ec641b1)
* daemon: Close augeas handle on exit.Richard W.M. Jones2012-01-241-0/+11
| | | | (cherry picked from commit 94a7fb9fc5d04615f23f94c34eb90c35d20ba117)
* daemon: Fix leak of strings in md-detail (found by valgrind).Richard W.M. Jones2012-01-241-2/+2
| | | | (cherry picked from commit ff2e685828ce6160de34756696069b80e35472e8)
* daemon: md: Whitespace changes, and use size_t for i instead of pointer.Richard W.M. Jones2012-01-241-20/+23
| | | | | This is just a code clean-up with no functional change. (cherry picked from commit 4c2101362edf5f2df5d018c3674b423de2a3538a)
* daemon: Fix leak of strings in blkid (found by valgrind).Richard W.M. Jones2012-01-241-2/+2
| | | | (cherry picked from commit aa978b75ae1df0d3111953114fafe0854c3f222e)
* daemon: blkid: Whitespace changes, and use size_t for i instead of pointer.Richard W.M. Jones2012-01-241-18/+21
| | | | | This is just a code clean-up with no functional change. (cherry picked from commit 43a6974cb35759d4772f610f3c92b0d31f0503ac)
* daemon: Return value from write syscall is ssize_t, not int.Richard W.M. Jones2012-01-241-1/+1
| | | | (cherry picked from commit f86c3a45ae19f5bb558ab9ead255ecaf004b24b0)
* daemon: Don't leak 'cmdline' (found by valgrind).Richard W.M. Jones2012-01-241-0/+2
| | | | (cherry picked from commit 9f8f1fd8560f2c3e7b625cf6d65a052cd061fd2e)
* daemon: Length of message is a 32 bit unsigned quantity.Richard W.M. Jones2012-01-241-2/+2
| | | | (cherry picked from commit f65f653ab1541400afe2f796ab1b20cd721e769d)
* daemon: Fix use of uninitialized stack data (found by valgrind).Richard W.M. Jones2012-01-241-0/+2
| | | | | | This uninitialized data was also sent over the protocol, potentially being a serious information leak. (cherry picked from commit 9cf7ecbe4fea5162b86e2c78c1a40cca737bc1da)
* daemon: Fix memory leak in 'initrd-cat' (found by valgrind).Richard W.M. Jones2012-01-241-0/+2
| | | | (cherry picked from commit 84242a8d0bf9c37e700cd8a3436607dbc7908f1e)
* debian: Debian 6 blkid has -p but not -i.Richard W.M. Jones2012-01-231-30/+62
| | | | | | Fix the existing test to work correctly in this case. Other cleanups.
* daemon: Move internal-autosync function to new file internal.c.Richard W.M. Jones2012-01-213-18/+47
| | | | This is just code motion.
* daemon: Run udev_settle after pwrite-device finishes.Richard W.M. Jones2012-01-192-4/+17
| | | | | | | 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.
* daemon: pwrite/pread: Don't double close on error path.Richard W.M. Jones2012-01-191-2/+0
| | | | | In Linux, close (fd) closes the file descriptor even if it returns an error.
* Tempus fugit.Richard W.M. Jones2012-01-1820-20/+20
| | | | Update all copyright dates to 2012.
* resize2fs-M: fix double-free along error path (thanks Matthew Booth).Richard W.M. Jones2012-01-161-4/+2
|
* e2fsck-f: change the internal to use e2fsckWanlong Gao2012-01-131-21/+7
| | | | | | | | 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>
* NEW API: add a new api e2fsckWanlong Gao2012-01-131-0/+49
| | | | | | | | | | | | | | 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>
* ext2: tweak the error returned message of resize2fs-M(BZ755729)Wanlong Gao2012-01-131-2/+7
| | | | | | | 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>
* daemon: debug segv correct use of dereferencing NULL.Richard W.M. Jones2012-01-091-1/+7
|
* mkfs: optimization and code cleanupWanlong Gao2011-12-231-15/+14
| | | | | | | | | | | 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.
* tests: Split regressions -> various subdirectories of tests/Richard W.M. Jones2011-12-221-2/+6
|
* daemon: Fix utimens so it doesn't hang on named pipes (RHBZ#761460).Richard W.M. Jones2011-12-081-18/+5
| | | | | | | | | | 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.
* daemon: Allow utimens to work for directories (RHBZ#761451).Richard W.M. Jones2011-12-081-1/+1
| | | | | | You don't need to open the file O_WRONLY in order to call futimens on the file descriptor. Opening it O_WRONLY fails for directories. Therefore open O_RDONLY instead.
* blkid: split the RHEL5 which can't support some optionsWanlong Gao2011-12-051-7/+73
| | | | | | | RHEL5 shoult not support '-p', '-i' and '-o export' options. But we just split it according to the '-p' option. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
* Revert "blkid: Use -c /dev/null because RHEL 5 blkid doesn't have -p option."Richard W.M. Jones2011-12-041-5/+2
| | | | This reverts commit 6533491b178d18bfab8240cf093be4ef9b547548.