Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 1 | From 5f47c30759684cea9a7a409646686c1a358b78ac Mon Sep 17 00:00:00 2001 |
| 2 | From: OpenEmbedded <oe.patch@oe> |
| 3 | Date: Wed, 11 Apr 2018 22:51:05 +0200 |
| 4 | Subject: [PATCH] replace basename() with sscanf() |
| 5 | |
| 6 | klibc lacks basename() |
| 7 | |
| 8 | Upstream-Status: Inappropriate [klibc specific] |
| 9 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> |
| 10 | |
| 11 | --- |
| 12 | kexec/arch/i386/x86-linux-setup.c | 4 ++-- |
| 13 | 1 file changed, 2 insertions(+), 2 deletions(-) |
| 14 | |
| 15 | diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c |
| 16 | index 6c7d260..7850083 100644 |
| 17 | --- a/kexec/arch/i386/x86-linux-setup.c |
| 18 | +++ b/kexec/arch/i386/x86-linux-setup.c |
| 19 | @@ -304,9 +304,9 @@ static int add_edd_entry(struct x86_linux_param_header *real_mode, |
| 20 | memset(edd_info, 0, sizeof(struct edd_info)); |
| 21 | |
| 22 | /* extract the device number */ |
| 23 | - if (sscanf(basename(sysfs_name), "int13_dev%hhx", &devnum) != 1) { |
| 24 | + if (sscanf(strrchr(sysfs_name,'/') + 1, "int13_dev%hhx", &devnum) != 1) { |
| 25 | fprintf(stderr, "Invalid format of int13_dev dir " |
| 26 | - "entry: %s\n", basename(sysfs_name)); |
| 27 | + "entry: %s\n", strrchr(sysfs_name,'/') + 1); |
| 28 | return -1; |
| 29 | } |
| 30 | |