www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/08/25/09:00:25

Message-ID: <39A67036.8671A366@softhome.net>
Date: Fri, 25 Aug 2000 15:10:14 +0200
From: Laurynas Biveinis <lauras AT softhome DOT net>
X-Mailer: Mozilla 4.74 [en] (Win98; U)
X-Accept-Language: lt,en
MIME-Version: 1.0
To: DJGPP Workers <djgpp-workers AT delorie DOT com>
Subject: __solve_dir_symlinks() tweaks
Reply-To: djgpp-workers AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019