Mail Archives: djgpp-workers/2000/08/25/09:00:25
I've commited the following:
Laurynas
Index: sdirlink.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/compat/unistd/sdirlink.c,v
retrieving revision 1.1
diff -u -r1.1 sdirlink.c
--- sdirlink.c 2000/08/25 11:35:37 1.1
+++ sdirlink.c 2000/08/25 12:57:19
@@ -2,6 +2,7 @@
#include <libc/stubs.h>
#include <libc/symlink.h>
+#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
@@ -10,6 +11,21 @@
{
char path_copy[FILENAME_MAX];
char * last_part;
+
+ /* Reject NULLs... */
+ if (!__symlink_path || !__real_path)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ /* ...and empty strings */
+ if (__symlink_path[0] == '\0')
+ {
+ errno = ENOENT;
+ return -1;
+ }
+
strcpy(path_copy, __symlink_path);
last_part = basename(path_copy);
if (*last_part == '\0')
- Raw text -