- 20 10月, 2011 2 次提交
-
-
由 Daniel P. Berrange 提交于
Stub out a complete impl of virFileOpenTty to avoid unused parameter warnings * src/util/util.c: Fix virFileOpenTty on Win32
-
由 Serge E. Hallyn 提交于
The glibc ones (intentionally) cannot handle ptys opened in a devpts not mounted at /dev/pts. Drop the (un-exported, unused) virFileOpenTtyAt. Signed-off-by: NSerge Hallyn <serge.hallyn@canonical.com> Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 14 10月, 2011 2 次提交
-
-
由 Jiri Denemark 提交于
-
由 Jiri Denemark 提交于
Setting a hostname that cannot be resolved is not the best configuration but since virGetHostname only calls getaddrinfo to get host's canonical name and we do not fail if the returned canonical name is NULL or "localhost", there is no reason why we should fail if getaddrinfo itself fails.
-
- 16 9月, 2011 1 次提交
-
-
由 Peter Krempa 提交于
/usr/lib/stdlib.h in Mac OS X and probably also in BSD's exports this symbol :(
-
- 25 8月, 2011 1 次提交
-
-
由 Laine Stump 提交于
virFileOpenAs takes desired uid:gid as arguments, and not only uses them for a fork/setuid/setgid when retrying failed open operations, but additionally always forces the opened file to be owned by the given uid:gid. One example of the problems this causes is that, when restoring a domain from a file that is owned by the qemu user, opening the file chowns it to root. if dynamic_ownership=1 this is coincidentally expected, but if dynamic_ownership=0, no existing file should ever have its ownership changed. This patch adds an extra check before calling fchown() - it only does it if O_CREAT was passed to virFileOpenAs() in the openflags.
-
- 17 8月, 2011 1 次提交
-
-
由 Stefan Berger 提交于
Get rid of the #if __linux__ check in virPidFileReadPathIfAlive that was preventing a check of a symbolic link in /proc/<pid>/exe on non-linux platforms against an expected executable. Replace this with a run-time check testing whether the /proc/<pid>/exe is a symbolic link and if so call the function doing the comparison against the expected file the link is supposed to point to.
-
- 13 8月, 2011 1 次提交
-
-
由 Daniel P. Berrange 提交于
The functions for manipulating pidfiles are in util/util.{c,h}. We will shortly be adding some further pidfile related functions. To avoid further growing util.c, this moves the pidfile related functions into a dedicated virpidfile.{c,h}. The functions are also all renamed to have 'virPidFile' as their name prefix * util/util.h, util/util.c: Remove all pidfile code * util/virpidfile.c, util/virpidfile.h: Add new APIs for pidfile handling. * lxc/lxc_controller.c, lxc/lxc_driver.c, network/bridge_driver.c, qemu/qemu_process.c: Add virpidfile.h include and adapt for API renames
-
- 03 8月, 2011 1 次提交
-
-
由 Eric Blake 提交于
Leak detected by Coverity; only possible on unlikely ptsname_r failure. Additionally, the man page for ptsname_r states that failure is merely non-zero, not necessarily -1. * src/util/util.c (virFileOpenTtyAt): Avoid leak on ptsname_r failure.
-
- 26 7月, 2011 1 次提交
-
-
由 Laine Stump 提交于
Although most functions in libvirt return 0 on success and < 0 on failure, there are a few functions lingering around that return errno (a positive value) on failure, and sometimes code calling those functions incorrectly assumes the <0 standard. I noticed one of these the other day when auditing networkStartDhcpDaemon after Guido Gunther found a place where success was improperly returned on failure (that patch has been acked and is pending a push). The problem was that it expected the return value from virFileReadPid to be < 0 on failure, but it was actually positive (it was also neglected to set the return code in this case, similar to the bug found by Guido). This all led to the fact that *all* of the virFile*Pid functions in util.c are returning errno on failure. This patch remedies that problem by changing them all to return -errno on failure, and makes any necessary changes to callers of the functions. (In the meantime, I also properly set the return code on failure of virFileReadPid in networkStartDhcpDaemon).
-
- 22 7月, 2011 1 次提交
-
-
由 Eric Blake 提交于
In preparation for a future patch adding new virFile APIs. * src/util/files.h, src/util/files.c: Move... * src/util/virfile.h, src/util/virfile.c: ...here, and rename functions to virFile prefix. Macro names are intentionally left alone. * *.c: All '#include "files.h"' uses changed. * src/Makefile.am (UTIL_SOURCES): Reflect rename. * cfg.mk (exclude_file_name_regexp--sc_prohibit_close): Likewise. * src/libvirt_private.syms: Likewise. * docs/hacking.html.in: Likewise. * HACKING: Regenerate.
-
- 16 7月, 2011 1 次提交
-
-
由 Eric Blake 提交于
Enforce the recent flags cleanups - we want to use 'unsigned int flags' in any of our APIs (except where backwards compatibility is important, in the public migration APIs), and that all flags are checked for validity (except when there are stub functions that completely ignore the flags argument). There are a few minor tweaks done here to avoid false positives: signed arguments passed to open() are renamed oflags, and flags arguments that are legitimately ignored are renamed flags_unused. * cfg.mk (sc_flags_usage): New rule. (exclude_file_name_regexp--sc_flags_usage): And a few exemptions. (sc_flags_debug): Tweak wording. * src/util/iohelper.c (runIO, main): Rename variable. * src/util/util.c (virSetInherit): Likewise. * src/fdstream.h (virFDStreamOpenFile, virFDStreamCreateFile): Likewise. * src/fdstream.c (virFDStreamOpenFileInternal) (virFDStreamOpenFile, virFDStreamCreateFile): Likewise. * src/util/command.c (virExecWithHook) [WIN32]: Likewise. * src/util/util.c (virFileOpenAs, virDirCreate) [WIN32]: Likewise. * src/locking/lock_manager.c (virLockManagerPluginNew) [!HAVE_DLFCN_H]: Likewise. * src/locking/lock_driver_nop.c (virLockManagerNopNew) (virLockManagerNopAddResource, virLockManagerNopAcquire) (virLockManagerNopRelease, virLockManagerNopInquire): Likewise.
-
- 14 7月, 2011 1 次提交
-
-
由 Jiri Denemark 提交于
In 2f4d2496 I didn't notice that one part of virFileOpenAs doesn't actually call to virFileOpenAsNoFork but rather includes a copy of the code from there.
-
- 13 7月, 2011 1 次提交
-
-
由 Eric Blake 提交于
I got bit in a debugging session on an uninstalled libvirtd; the code tried to call out to the installed $LIBEXECDIR/libvirt_iohelper instead of my just-built version. So I set a breakpoint and altered the binary name to be "./src/libvirt_iohelper", and it still failed because I don't have "." on my PATH. According to POSIX, execvp only searches PATH if the name does not contain a slash. Since we are trying to mimic that behavior, an anchored name should be relative to the current working dir. This tightens existing behavior, but most callers already pass an absolute name or a name with no slashes, so it probably won't be noticeable. * src/util/util.c (virFindFileInPath): Anchored relative names do not invoke a PATH search.
-
- 12 7月, 2011 1 次提交
-
-
由 Daniel P. Berrange 提交于
Avoid re-formatting the pidfile path everytime we need it. Create it once when starting the guest, and preserve it until the guest is shutdown. * src/libvirt_private.syms, src/util/util.c, src/util/util.h: Add virFileReadPidPath * src/qemu/qemu_domain.h: Add pidfile field * src/qemu/qemu_process.c: Store pidfile path in qemuDomainObjPrivate
-
- 08 7月, 2011 2 次提交
-
-
由 Jiri Denemark 提交于
When virFileOpenAs is called with VIR_FILE_OPEN_AS_UID flag and uid/gid different from root/root while libvirtd is running as root, we fork a new child, change its effective UID/GID to uid/gid and run virFileOpenAsNoFork. It doesn't make any sense to fchown() the opened file in this case since we already know that uid/gid can access the file when open succeeds and one of the following situations may happen: - the file is already owned by uid/gid and we skip fchown even before this patch - the file is owned by uid but not gid because it was created in a directory with SETGID set, in which case it is desirable not to change the group - the file may be owned by a completely different user and/or group because it was created on a root-squashed or even all-squashed NFS filesystem, in which case fchown would most likely fail anyway
-
由 Eric Blake 提交于
No caller was using the flags argument, and this function is internal only, so we might as well skip it. * src/util/util.h (safezero): Update signature. * src/util/util.c (safezero): Update function. * src/locking/lock_driver_sanlock.c (virLockManagerSanlockSetupLockspace) (virLockManagerSanlockCreateLease): Update all callers. * src/storage/storage_backend.c (createRawFile): Likewise.
-
- 07 7月, 2011 2 次提交
-
-
由 Eric Blake 提交于
The next patch wants to adjust an end pointer to trim trailing spaces but without modifying the underlying string, but a more generally useful ability to trim trailing spaces in place is also worth providing. * src/util/util.h (virTrimSpaces, virSkipSpacesBackwards): New prototypes. * src/util/util.c (virTrimSpaces, virSkipSpacesBackwards): New functions. * src/libvirt_private.syms (util.h): Export new functions. Inspired by a patch by Minoru Usui.
-
由 Eric Blake 提交于
Most clients of virSkipSpaces don't want to omit backslashes. Also, open-coding the list of spaces is not as nice as using c_isspace. * src/util/util.c (virSkipSpaces): Use c_isspace. (virSkipSpacesAndBackslash): New function. * src/util/util.h (virSkipSpacesAndBackslash): New prototype. * src/xen/xend_internal.c (sexpr_to_xend_topology): Update caller. * src/libvirt_private.syms (util.h): Export new function.
-
- 06 7月, 2011 2 次提交
-
-
由 Matthias Bolte 提交于
Move stat and mkdir to virFileMakePathHelper. Also use the stat result to detect whether the existing path is a directory and set errno accordingly if it's not.
-
由 Matthias Bolte 提交于
Some callers expected virFileMakePath to set errno, some expected it to return an errno value. Unify this to return 0 on success and -1 on error. Set errno to report detailed error information. Also optimize virFileMakePath if stat fails with an errno different from ENOENT.
-
- 02 7月, 2011 1 次提交
-
-
由 Eric Blake 提交于
To avoid regressions, we let callers specify whether to require a minor and micro version. Callers that were parsing uname() output benefit from defaulting to 0, whereas callers that were parsing version strings from other sources should not change in behavior. * src/util/util.c (virParseVersionString): Allow caller to choose whether to fail if minor or micro is missing. * src/util/util.h (virParseVersionString): Update signature. * src/esx/esx_driver.c (esxGetVersion): Update callers. * src/lxc/lxc_driver.c (lxcVersion): Likewise. * src/openvz/openvz_conf.c (openvzExtractVersionInfo): Likewise. * src/uml/uml_driver.c (umlGetVersion): Likewise. * src/vbox/vbox_MSCOMGlue.c (vboxLookupVersionInRegistry): Likewise. * src/vbox/vbox_tmpl.c (vboxExtractVersion): Likewise. * src/vmware/vmware_conf.c (vmwareExtractVersion): Likewise. * src/xenapi/xenapi_driver.c (xenapiGetVersion): Likewise. Reported by Matthias Bolte.
-
- 01 7月, 2011 1 次提交
-
-
由 Scott Moser 提交于
linux 3.0 has no micro version number, and that is causing problems for virParseVersionString. The patch below should allow for: major major.minor major.minor.micro If major or minor are not present they just default to zero. We found this in Ubuntu (https://bugs.launchpad.net/bugs/802977)
-
- 21 6月, 2011 1 次提交
-
-
由 Cole Robinson 提交于
Since we virEventRegisterDefaultImpl is now a public API, callers need a way to invoke the default registered Handle and Timeout functions. We already have general functions for these internally, so promote them to the public API. v2: Actually add APIs to libvirt.h
-
- 17 6月, 2011 1 次提交
-
-
由 Daniel P. Berrange 提交于
Most of the safezero() implementations return -1 on error, setting errno. The safezero() impl using posix_fallocate() though returned a positive errno value on error (due to the unusual API contract of posix_fallocate() compared to most syscall APIs). * src/util/util.c: Ensure safezero() returns -1 and sets errno on error. * src/storage/storage_backend.c: Change safezero != 0 to < 0 for detecting errors
-
- 14 6月, 2011 1 次提交
-
-
由 Stefan Berger 提交于
The below patch decreases the response time of libvirt to errors reported by Qemu upon startup by checking whether the qemu process is still alive while polling for the local socket to show up. This patch also introduces a special handling of signal for the Win32 part of virKillProcess.
-
- 13 6月, 2011 1 次提交
-
-
由 Jiri Denemark 提交于
-
- 08 6月, 2011 1 次提交
-
-
由 Cole Robinson 提交于
Seems reasonable to have all command wrappers in the same place v2: Dont move SetInherit v3: Comment spelling fix Adjust WARN0 comment Remove spurious #include movement Don't include sys/types.h Combine virExec enums Signed-off-by: NCole Robinson <crobinso@redhat.com>
-
- 07 6月, 2011 2 次提交
-
-
由 Cole Robinson 提交于
v2: Simplify command building Handle command building failure v3: Remove unneeded NULL check Signed-off-by: NCole Robinson <crobinso@redhat.com>
-
由 Cole Robinson 提交于
v3: Remove obsolete comment Signed-off-by: NCole Robinson <crobinso@redhat.com>
-
- 24 5月, 2011 2 次提交
-
-
由 Jiri Denemark 提交于
Two additional places need initgroups call to properly work in an environment where the UID is allowed to open/create stuff through its supplementary groups.
-
由 Jiri Denemark 提交于
-
- 17 5月, 2011 3 次提交
-
-
由 Daniel P. Berrange 提交于
* src/util/util.c: Fix virRun prototype
-
由 Eric Blake 提交于
POSIX allows sysconf(_SC_GETPW_R_SIZE_MAX) to return -1 if there is no fixed limit, and requires ERANGE errors to track real size. Model our behavior after the example in POSIX itself: http://pubs.opengroup.org/onlinepubs/9699919799/functions/getpwuid_r.html Also, on error for get*_r functions, errno is undefined, and the real error was the return value. * src/util/util.c (virGetUserEnt, virGetUserID, virGetGroupID) (virSetUIDGID): Cope with sysconf failure or too small buffer. Reported by Matthias Bolte.
-
由 Cole Robinson 提交于
virRunWithHook is now unused, so we can drop it. Tested w/ raw + qcow2 volume creation and copying. v2: Use opaque data to skip hook second time around Simply command building v3: Drop explicit FindFileInPath
-
- 14 5月, 2011 2 次提交
-
-
由 Cole Robinson 提交于
All callers were expecting argv logging, so the split is unneeded. v2: Reindent new virExecWithHook call
-
由 Cole Robinson 提交于
And drop the now unused virExecDaemonize
-
- 12 5月, 2011 1 次提交
-
-
由 Lai Jiangshan 提交于
These VIR_XXXX0 APIs make us confused, use the non-0-suffix APIs instead. How do these coversions works? The magic is using the gcc extension of ##. When __VA_ARGS__ is empty, "##" will swallow the "," in "fmt," to avoid compile error. example: origin after CPP high_level_api("%d", a_int) low_level_api("%d", a_int) high_level_api("a string") low_level_api("a string") About 400 conversions. 8 special conversions: VIR_XXXX0("") -> VIR_XXXX("msg") (avoid empty format) 2 conversions VIR_XXXX0(string_literal_with_%) -> VIR_XXXX(%->%%) 0 conversions VIR_XXXX0(non_string_literal) -> VIR_XXXX("%s", non_string_literal) (for security) 6 conversions Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
-
- 06 5月, 2011 1 次提交
-
-
由 Michal Privoznik 提交于
Users often edit XML file stored in configuration directory thinking of modifying a domain/network/pool/etc. Thus it is wise to let them know they are using the wrong way and give them hint.
-
- 04 5月, 2011 1 次提交
-
-
由 Eric Blake 提交于
Clang complained about this, and it was easy enough to fix. * src/util/util.c (virFileOpenAs): Drop dead assignment.
-