Usr get_last_path_component() name basename()
diff --git a/findutils/grep.c b/findutils/grep.c
index d39dac1..0fe898c 100644
--- a/findutils/grep.c
+++ b/findutils/grep.c
@@ -244,7 +244,8 @@
 #endif
 
 #ifdef CONFIG_FEATURE_GREP_EGREP_ALIAS
-	if (strcmp (basename (argv[0]), "egrep") == 0)
+	junk = get_last_path_component(argv[0]);
+	if (junk && strcmp(junk, "egrep") == 0)
 		reflags |= REG_EXTENDED;
 #endif