Followup on RT3334 fix: make sure that a directory that's the empty
string returns 0 with errno = ENOENT. Reviewed-by: Andy Polyakov <appro@openssl.org> (cherry picked from commit 360928b7d0f16dde70e26841bbf9e1af727e8b8f)
This commit is contained in:
parent
a49256a349
commit
a60aa7e008
@ -1,4 +1,3 @@
|
|||||||
/* $LP: LPlib/source/LPdir_vms.c,v 1.20 2004/08/26 13:36:05 _cvs_levitte Exp $ */
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2004, Richard Levitte <richard@levitte.org>
|
* Copyright (c) 2004, Richard Levitte <richard@levitte.org>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -88,6 +87,12 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
|
|||||||
size_t filespeclen = strlen(directory);
|
size_t filespeclen = strlen(directory);
|
||||||
char *filespec = NULL;
|
char *filespec = NULL;
|
||||||
|
|
||||||
|
if (filespeclen == 0)
|
||||||
|
{
|
||||||
|
errno = ENOENT;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* MUST be a VMS directory specification! Let's estimate if it is. */
|
/* MUST be a VMS directory specification! Let's estimate if it is. */
|
||||||
if (directory[filespeclen-1] != ']'
|
if (directory[filespeclen-1] != ']'
|
||||||
&& directory[filespeclen-1] != '>'
|
&& directory[filespeclen-1] != '>'
|
||||||
|
@ -66,6 +66,12 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
|
|||||||
char *extdirbuf = NULL;
|
char *extdirbuf = NULL;
|
||||||
size_t dirlen = strlen (directory);
|
size_t dirlen = strlen (directory);
|
||||||
|
|
||||||
|
if (dirlen == 0)
|
||||||
|
{
|
||||||
|
errno = ENOENT;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
*ctx = (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX));
|
*ctx = (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX));
|
||||||
if (*ctx == NULL)
|
if (*ctx == NULL)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user