Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37568231
en ru br
Репозитории ALT
S:0.17-alt5.1
4.1: 0.17-alt2
4.0: 0.17-ipl9mdk
3.0: 0.17-ipl9mdk
www.altlinux.org/Changes

Группа :: Сети/Удалённый доступ
Пакет: rsh

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: netkit-rsh-0.17-rh784467.patch
Скачать


diff -up netkit-rsh-0.17/rcp/rcp.c.rh784467 netkit-rsh-0.17/rcp/rcp.c
--- netkit-rsh-0.17/rcp/rcp.c.rh784467	2012-01-31 15:47:57.996697245 +0100
+++ netkit-rsh-0.17/rcp/rcp.c	2012-01-31 17:11:23.489578305 +0100
@@ -511,6 +511,37 @@ notreg:			(void)close(f);
 	}
 }
 
+static char *
+rcp_basename(char *path)
+{
+	char *bname;
+
+	if (path == NULL || *path == '\0')
+		return NULL;
+
+retry:
+	/* Note this is GNU basename */
+	bname = basename(path);
+	if (*bname == '\0') {
+		/* path ends with '/', strip them all */
+		char *end = path + strlen(path) - 1;
+		while (path <= end && *end == '/') {
+			*end = '\0';
+			end--;
+		}
+
+		if (end < path) {
+			/* The path consists only from '/' chars */
+			*path = '/';
+			return path;
+		} else {
+			/* We removed all trailing '/' characters */
+			goto retry;
+		}
+	} else
+		return bname;
+}
+
 static void
 rsource(char *name, struct stat *statp)
 {
@@ -522,7 +553,7 @@ rsource(char *name, struct stat *statp)
 		error("rcp: %s: %s\n", name, strerror(errno));
 		return;
 	}
-	last = strrchr(name, '/');
+	last = rcp_basename(name);
 	if (last == 0)
 		last = name;
 	else
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin