mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-21 00:41:24 +00:00
Merge branch 'custom-2.2.10' into 'next'
Made filesearch aware of symbolic links See merge request STJr/SRB2!1976
This commit is contained in:
commit
520d1c16da
2 changed files with 28 additions and 2 deletions
|
@ -23,6 +23,16 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#ifndef S_ISLNK
|
||||||
|
#define IGNORE_SYMLINKS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef IGNORE_SYMLINKS
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <libgen.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "filesrch.h"
|
#include "filesrch.h"
|
||||||
|
@ -461,6 +471,9 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
|
||||||
}
|
}
|
||||||
else if (!strcasecmp(searchname, dent->d_name))
|
else if (!strcasecmp(searchname, dent->d_name))
|
||||||
{
|
{
|
||||||
|
#ifndef IGNORE_SYMLINKS
|
||||||
|
struct stat statbuf;
|
||||||
|
#endif
|
||||||
switch (checkfilemd5(searchpath, wantedmd5sum))
|
switch (checkfilemd5(searchpath, wantedmd5sum))
|
||||||
{
|
{
|
||||||
case FS_FOUND:
|
case FS_FOUND:
|
||||||
|
@ -468,6 +481,19 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
|
||||||
strcpy(filename,searchpath);
|
strcpy(filename,searchpath);
|
||||||
else
|
else
|
||||||
strcpy(filename,dent->d_name);
|
strcpy(filename,dent->d_name);
|
||||||
|
#ifndef IGNORE_SYMLINKS
|
||||||
|
if (lstat(filename, &statbuf) != -1)
|
||||||
|
{
|
||||||
|
if (S_ISLNK(statbuf.st_mode))
|
||||||
|
{
|
||||||
|
char *tempbuf = realpath(filename, NULL);
|
||||||
|
if (!tempbuf)
|
||||||
|
I_Error("Error parsing link %s: %s", filename, strerror(errno));
|
||||||
|
strncpy(filename, tempbuf, MAX_WADPATH);
|
||||||
|
free(tempbuf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
retval = FS_FOUND;
|
retval = FS_FOUND;
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -3671,11 +3671,11 @@ static void Got_RequestAddfoldercmd(UINT8 **cp, INT32 playernum)
|
||||||
|
|
||||||
static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
|
static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
|
||||||
{
|
{
|
||||||
char filename[241];
|
char filename[MAX_WADPATH+1];
|
||||||
filestatus_t ncs = FS_NOTCHECKED;
|
filestatus_t ncs = FS_NOTCHECKED;
|
||||||
UINT8 md5sum[16];
|
UINT8 md5sum[16];
|
||||||
|
|
||||||
READSTRINGN(*cp, filename, 240);
|
READSTRINGN(*cp, filename, MAX_WADPATH);
|
||||||
READMEM(*cp, md5sum, 16);
|
READMEM(*cp, md5sum, 16);
|
||||||
|
|
||||||
if (playernum != serverplayer)
|
if (playernum != serverplayer)
|
||||||
|
|
Loading…
Reference in a new issue