aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/ChangeLog8
-rw-r--r--util/memory.c3
-rw-r--r--util/riscos.c37
3 files changed, 33 insertions, 15 deletions
diff --git a/util/ChangeLog b/util/ChangeLog
index 301b9e504..e65b81af2 100644
--- a/util/ChangeLog
+++ b/util/ChangeLog
@@ -1,3 +1,11 @@
+2003-12-28 Stefan Bellon <[email protected]>
+
+ * riscos.c [__riscos__]: Better filetype handling (use a
+ different SWI) and removal of unnecessary function.
+
+ * memory.c (out_of_core) [__riscos__]: Produce stack backtrace on
+ RISC OS if out_of_core() is called and M_GUARD is compiled in.
+
2003-12-06 David Shaw <[email protected]>
* http.c (send_request): Add a Host: header for virtual hosts.
diff --git a/util/memory.c b/util/memory.c
index cb8a3b3e3..c062bdd5f 100644
--- a/util/memory.c
+++ b/util/memory.c
@@ -406,6 +406,9 @@ out_of_core(size_t n, int secure)
log_info ("(this may be caused by too many secret keys used "
"simultaneously or due to excessive large key sizes)\n");
}
+#if defined(M_GUARD) && defined(__riscos__)
+ abort();
+#endif
exit (2);
}
diff --git a/util/riscos.c b/util/riscos.c
index 70ec98fb7..256f3f65d 100644
--- a/util/riscos.c
+++ b/util/riscos.c
@@ -23,6 +23,7 @@
#include <config.h>
#include <stdlib.h>
+#include <string.h>
#include <signal.h>
#include <fcntl.h>
#include <unistd.h>
@@ -32,11 +33,18 @@
#include "util.h"
#include "memory.h"
+#include <unixlib/local.h> /* needed for RISCOSIFY_NO_PROCESS */
#define __UNIXLIB_INTERNALS
#include <unixlib/swiparams.h> /* needed for MMM_TYPE_* definitions */
#undef __UNIXLIB_INTERNALS
+/* static symbols that trigger UnixLib behaviour */
+
+int __riscosify_control = __RISCOSIFY_NO_PROCESS;
+int __feature_imagefs_is_file = 1;
+
+
/* RISC OS file open descriptor control list */
struct fds_item {
@@ -69,13 +77,6 @@ is_read_only(const char *filename)
/* exported RISC OS functions */
-void
-riscos_global_defaults(void)
-{
- __riscosify_control = __RISCOSIFY_NO_PROCESS;
- __feature_imagefs_is_file = 1;
-}
-
int
riscos_load_module(const char *name, const char * const path[], int fatal)
{
@@ -118,10 +119,13 @@ riscos_get_filetype(const char *filename)
{
int result;
- if (_swix(OS_File, _INR(0,1) | _OUT(6), 23, filename, &result))
+ if (_swix(OS_File, _INR(0,1) | _OUT(2), 17, filename, &result))
log_fatal("Can't get filetype for file \"%s\"!\n", filename);
- return result;
+ if ((result & 0xfff00000) == 0xfff00000)
+ return (result & 0xfff00) >> 8;
+ else
+ return 0;
}
void
@@ -307,18 +311,21 @@ riscos_gstrans(const char *old)
char *
riscos_make_basename(const char *filepath, const char *realfname)
{
- char *result, *p = (char*)filepath-1;
+ char *result, *p;
int i, filetype;
- if ( !(p=strrchr(filepath, DIRSEP_C)) )
- if ( !(p=strrchr(filepath, ':')) )
- ;
+ if ( (p = strrchr(filepath, DIRSEP_C)) )
+ p++;
+ else if ( (p = strrchr(filepath, ':')) )
+ p++;
+ else
+ p = (char*) filepath;
- i = strlen(p+1);
+ i = strlen(p);
result = m_alloc(i + 5);
if (!result)
log_fatal("Can't claim memory for riscos_make_basename() buffer!\n");
- strcpy(result, p+1);
+ strcpy(result, p);
filetype = riscos_get_filetype( realfname );
result[i++] = ',';