mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +03:00
Fixed some minor annoyances with dlsym
- Added missing newline character to "File not found" message - Now properly handles relative file paths
This commit is contained in:
parent
118b002ee8
commit
68beb4b1a3
BIN
plugins/dlsym
BIN
plugins/dlsym
Binary file not shown.
@ -5,26 +5,29 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <dlfcn.h>
|
||||
#include <limits.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *file=NULL;
|
||||
void *dl= NULL;
|
||||
FILE *fp = NULL;
|
||||
char path[PATH_MAX];
|
||||
if (argc != 2)
|
||||
{
|
||||
printf("Usage: dlsym <file>\n");
|
||||
exit(0);
|
||||
}
|
||||
file = argv[1];
|
||||
fp = fopen(file, "rb");
|
||||
realpath(file, path);
|
||||
fp = fopen(path, "rb");
|
||||
if (!fp)
|
||||
{
|
||||
printf("File not found.");
|
||||
printf("File not found.\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
dl = dlopen(file, RTLD_NOW);
|
||||
dl = dlopen(path, RTLD_NOW);
|
||||
|
||||
if (dl)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user