1.1 --- a/libfsserver/lib/files/opener_context_resource.cc Mon Feb 27 14:46:13 2023 +0100
1.2 +++ b/libfsserver/lib/files/opener_context_resource.cc Tue Feb 28 22:35:25 2023 +0100
1.3 @@ -1,7 +1,7 @@
1.4 /*
1.5 * A context resource offering support for opening files.
1.6 *
1.7 - * Copyright (C) 2021, 2022 Paul Boddie <paul@boddie.org.uk>
1.8 + * Copyright (C) 2021, 2022, 2023 Paul Boddie <paul@boddie.org.uk>
1.9 *
1.10 * This program is free software; you can redistribute it and/or
1.11 * modify it under the terms of the GNU General Public License as
1.12 @@ -43,28 +43,11 @@
1.13
1.14
1.15
1.16 -/* Data access methods. */
1.17 -
1.18 -char *OpenerContextResource::get_path(offset_t offset)
1.19 -{
1.20 - char *buffer = _region->read(offset);
1.21 - offset_t size = _region->size();
1.22 -
1.23 - /* Confine the path to the limit of the buffer. */
1.24 -
1.25 - if ((buffer != NULL) && (strnlen(buffer, size) < size))
1.26 - return buffer;
1.27 - else
1.28 - return NULL;
1.29 -}
1.30 -
1.31 -
1.32 -
1.33 /* Opener context interface methods. */
1.34
1.35 long OpenerContextResource::mkdir(sys_mode_t mode)
1.36 {
1.37 - char *path = get_path();
1.38 + char *path = get_string();
1.39
1.40 if (path == NULL)
1.41 return -L4_EINVAL;
1.42 @@ -75,7 +58,7 @@
1.43 long OpenerContextResource::open(flags_t flags, offset_t *size,
1.44 l4_cap_idx_t *file, object_flags_t *object_flags)
1.45 {
1.46 - char *path = get_path();
1.47 + char *path = get_string();
1.48
1.49 if (path == NULL)
1.50 return -L4_EINVAL;
1.51 @@ -85,7 +68,7 @@
1.52
1.53 long OpenerContextResource::remove()
1.54 {
1.55 - char *path = get_path();
1.56 + char *path = get_string();
1.57
1.58 if (path == NULL)
1.59 return -L4_EINVAL;
1.60 @@ -97,12 +80,12 @@
1.61 {
1.62 char *source, *target;
1.63
1.64 - source = get_path();
1.65 + source = get_string();
1.66
1.67 if (source == NULL)
1.68 return -L4_EINVAL;
1.69
1.70 - target = get_path(strlen(source) + 1);
1.71 + target = get_string(strlen(source) + 1);
1.72
1.73 if (target == NULL)
1.74 return -L4_EINVAL;
1.75 @@ -112,7 +95,7 @@
1.76
1.77 long OpenerContextResource::stat()
1.78 {
1.79 - char *path = get_path();
1.80 + char *path = get_string();
1.81
1.82 if (path == NULL)
1.83 return -L4_EINVAL;