summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/fs-util.c23
-rw-r--r--src/basic/khash.c2
-rw-r--r--src/basic/proc-cmdline.c2
-rw-r--r--src/basic/virt.c2
4 files changed, 13 insertions, 16 deletions
diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c
index e31fa2711a..8fe19ee4e4 100644
--- a/src/basic/fs-util.c
+++ b/src/basic/fs-util.c
@@ -723,6 +723,8 @@ int chase_symlinks(const char *path, const char *original_root, unsigned flags,
return -errno;
if (S_ISLNK(st.st_mode)) {
+ char *joined;
+
_cleanup_free_ char *destination = NULL;
/* This is a symlink, in this case read the destination. But let's make sure we don't follow
@@ -746,9 +748,6 @@ int chase_symlinks(const char *path, const char *original_root, unsigned flags,
if (fd < 0)
return -errno;
- free_and_replace(buffer, destination);
-
- todo = buffer;
free(done);
/* Note that we do not revalidate the root, we take it as is. */
@@ -760,19 +759,17 @@ int chase_symlinks(const char *path, const char *original_root, unsigned flags,
return -ENOMEM;
}
- } else {
- char *joined;
+ }
- /* A relative destination. If so, this is what we'll prefix what's left to do with what
- * we just read, and start the loop again, but remain in the current directory. */
+ /* Prefix what's left to do with what we just read, and start the loop again,
+ * but remain in the current directory. */
- joined = strjoin("/", destination, todo);
- if (!joined)
- return -ENOMEM;
+ joined = strjoin("/", destination, todo);
+ if (!joined)
+ return -ENOMEM;
- free(buffer);
- todo = buffer = joined;
- }
+ free(buffer);
+ todo = buffer = joined;
continue;
}
diff --git a/src/basic/khash.c b/src/basic/khash.c
index 9a2a3edb75..84648dc1c9 100644
--- a/src/basic/khash.c
+++ b/src/basic/khash.c
@@ -143,7 +143,7 @@ int khash_dup(khash *h, khash **ret) {
copy->fd = -1;
copy->algorithm = strdup(h->algorithm);
- if (!copy)
+ if (!copy->algorithm)
return -ENOMEM;
copy->fd = accept4(h->fd, NULL, 0, SOCK_CLOEXEC);
diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c
index 6ecb6c3f0d..f703e7f145 100644
--- a/src/basic/proc-cmdline.c
+++ b/src/basic/proc-cmdline.c
@@ -148,7 +148,7 @@ int proc_cmdline_get_key(const char *key, unsigned flags, char **value) {
* a) The "value" parameter is used. In this case a parameter beginning with the "key" string followed by "="
* is searched, and the value following this is returned in "value".
*
- * b) as above, but the PROC_CMDLINE_VALUE_OPTIONAL flag is set. In this case if the the key is found as a
+ * b) as above, but the PROC_CMDLINE_VALUE_OPTIONAL flag is set. In this case if the key is found as a
* separate word (i.e. not followed by "=" but instead by whitespace or the end of the command line), then
* this is also accepted, and "value" is returned as NULL.
*
diff --git a/src/basic/virt.c b/src/basic/virt.c
index 33641e6886..03ce71a728 100644
--- a/src/basic/virt.c
+++ b/src/basic/virt.c
@@ -49,7 +49,7 @@ static int detect_vm_cpuid(void) {
{ "KVMKVMKVM", VIRTUALIZATION_KVM },
/* http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458 */
{ "VMwareVMware", VIRTUALIZATION_VMWARE },
- /* http://msdn.microsoft.com/en-us/library/ff542428.aspx */
+ /* https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/tlfs */
{ "Microsoft Hv", VIRTUALIZATION_MICROSOFT },
/* https://wiki.freebsd.org/bhyve */
{ "bhyve bhyve ", VIRTUALIZATION_BHYVE },