Skip to content

Commit

Permalink
'flags' should only be set inside DSO_load() if constructing a new DSO
Browse files Browse the repository at this point in the history
object - otherwise we overwrite any flags that had been previously set in
the DSO before calling DSO_load().
  • Loading branch information
Geoff Thorpe committed Nov 22, 2001
1 parent a542db9 commit 9163b8f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
3 changes: 1 addition & 2 deletions crypto/dso/dso.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ DSO_METHOD *DSO_set_method(DSO *dso, DSO_METHOD *meth);
* for the first and third parameters. Use DSO_up and DSO_free for
* subsequent reference count handling. Any flags passed in will be set
* in the constructed DSO after its init() function but before the
* load operation. This will be done with;
* DSO_ctrl(dso, DSO_CTRL_SET_FLAGS, flags, NULL); */
* load operation. If 'dso' is non-NULL, 'flags' is ignored. */
DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags);

/* This function binds to a variable inside a shared library. */
Expand Down
13 changes: 6 additions & 7 deletions crypto/dso/dso_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags)
goto err;
}
allocated = 1;
/* Pass the provided flags to the new DSO object */
if(DSO_ctrl(ret, DSO_CTRL_SET_FLAGS, flags, NULL) < 0)
{
DSOerr(DSO_F_DSO_LOAD,DSO_R_CTRL_FAILED);
goto err;
}
}
else
ret = dso;
Expand All @@ -228,13 +234,6 @@ DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags)
DSOerr(DSO_F_DSO_LOAD,DSO_R_NO_FILENAME);
goto err;
}
/* Bleurgh ... have to check for negative return values for
* errors. <grimace> */
if(DSO_ctrl(ret, DSO_CTRL_SET_FLAGS, flags, NULL) < 0)
{
DSOerr(DSO_F_DSO_LOAD,DSO_R_CTRL_FAILED);
goto err;
}
if(ret->meth->dso_load == NULL)
{
DSOerr(DSO_F_DSO_LOAD,DSO_R_UNSUPPORTED);
Expand Down

0 comments on commit 9163b8f

Please sign in to comment.