diff options
| author | Peter Jones <pjones@redhat.com> | 2013-11-20 12:20:23 -0500 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2013-11-21 11:48:24 -0500 |
| commit | e62b69a5b0b87c6df7a4fc23906134945309e927 (patch) | |
| tree | d6e987ec46dbfaf7f06e035c0a3bbcac578262d3 /include | |
| parent | 8b48ec5c70cd97d37f48581a4eab8139c1a95a1f (diff) | |
| download | efi-boot-shim-e62b69a5b0b87c6df7a4fc23906134945309e927.tar.gz efi-boot-shim-e62b69a5b0b87c6df7a4fc23906134945309e927.zip | |
Fix path generation for Dhcpv4 bootloader.
Right now we always look for e.g. "\grubx64.efi", which is completely
wrong. This makes it look for the path shim was loaded from and modify
that to end in a sanitized version of our default loader name.
Resolves: rhbz#1032583
Signed-off-by: Peter Jones <pjones@redhat.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/str.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/include/str.h b/include/str.h new file mode 100644 index 00000000..0f3e003a --- /dev/null +++ b/include/str.h @@ -0,0 +1,45 @@ +#ifndef SHIM_STR_H +#define SHIM_STR_H + +static inline +__attribute__((unused)) +unsigned long strnlena(const CHAR8 *s, unsigned long n) +{ + unsigned long i; + for (i = 0; i <= n; i++) + if (s[i] == '\0') + break; + return i; +} + +static inline +__attribute__((unused)) +CHAR8 * +strncpya(CHAR8 *dest, const CHAR8 *src, unsigned long n) +{ + unsigned long i; + + for (i = 0; i < n && src[i] != '\0'; i++) + dest[i] = src[i]; + for (; i < n; i++) + dest[i] = '\0'; + + return dest; +} + +static inline +__attribute__((unused)) +CHAR8 * +strcata(CHAR8 *dest, const CHAR8 *src) +{ + unsigned long dest_len = strlena(dest); + unsigned long i; + + for (i = 0; src[i] != '\0'; i++) + dest[dest_len + i] = src[i]; + dest[dest_len + i] = '\0'; + + return dest; +} + +#endif /* SHIM_STR_H */ |
