mirror of
https://git.proxmox.com/git/efi-boot-shim
synced 2025-06-02 08:20:48 +00:00

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>
46 lines
748 B
C
46 lines
748 B
C
#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 */
|