Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 1 | From 7823956149c78e1996c567d1965803456df090f8 Mon Sep 17 00:00:00 2001 |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 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 |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 16 | index 6cda12c..5514c1c 100644 |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 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 | |