summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/kash/expand.c15
-rw-r--r--src/kmk/config.h.linux21
-rw-r--r--src/lib/nt/ntopenat.c3
3 files changed, 26 insertions, 13 deletions
diff --git a/src/kash/expand.c b/src/kash/expand.c
index ff30455..1131865 100644
--- a/src/kash/expand.c
+++ b/src/kash/expand.c
@@ -1555,15 +1555,15 @@ STATIC char *
cvtnum(shinstance *psh, int num, char *buf)
{
char temp[32];
+ char *p = &temp[sizeof(temp) - 1];
int neg = num < 0;
- char *p = temp + 31;
-
- temp[31] = '\0';
+ if (neg)
+ num = -num;
+ *p = '\0';
do {
*--p = num % 10 + '0';
} while ((num /= 10) != 0);
-
if (neg)
*--p = '-';
@@ -1576,11 +1576,12 @@ STATIC char *
cvtnum64(shinstance *psh, KI64 num, char *buf)
{
char temp[32];
+ char *p = &temp[sizeof(temp) - 1];
int neg = num < 0;
- char *p = temp + 31;
-
- temp[31] = '\0';
+ if (neg)
+ num = -num;
+ *p = '\0';
do {
*--p = num % 10 + '0';
} while ((num /= 10) != 0);
diff --git a/src/kmk/config.h.linux b/src/kmk/config.h.linux
index 99c5fa4..2c7a412 100644
--- a/src/kmk/config.h.linux
+++ b/src/kmk/config.h.linux
@@ -1,5 +1,5 @@
/* config.h. Generated from config.h.in by configure. */
-/* config.h.in. Generated from configure.in by autoheader. */
+/* config.h.in. Generated from configure.ac by autoheader. */
/*
* bird: Move up this bunch so we can include features.h early.
@@ -71,7 +71,9 @@
/* Define to 1 if you have the declaration of `bsd_signal', and to 0 if you
don't. */
-/* #define HAVE_DECL_BSD_SIGNAL 1 */
+#if !defined(KBUILD_ARCH_X86) && !defined(KBUILD_ARCH_AMD64)
+# define HAVE_DECL_BSD_SIGNAL 1
+#endif
/* Define to 1 if you have the declaration of `dlerror', and to 0 if you
don't. */
@@ -348,7 +350,13 @@
#define HAVE_WORKING_VFORK 1
/* Build host information. (not used by kmk) */
-#define MAKE_HOST "i686-pc-linux-gnu"
+#if defined(KBUILD_ARCH_X86)
+# define MAKE_HOST "i686-pc-linux-gnu"
+#elif defined(KBUILD_ARCH_AMD64)
+# define MAKE_HOST "amd64-pc-linux-gnu"
+#else
+# define MAKE_HOST "aarch64-unknown-linux-gnu"
+#endif
/* Define to 1 to enable job server support in GNU make. */
#define MAKE_JOBSERVER 1
@@ -435,7 +443,6 @@
<sys/cpustats.h>. */
/* #undef UMAX4_3 */
-
/* Version number of package */
#define VERSION "4.2.1"
@@ -451,7 +458,11 @@
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
-#define _FILE_OFFSET_BITS 64
+#if defined(KBUILD_ARCH_X86) || defined(KBUILD_ARCH_AMD64)
+# define _FILE_OFFSET_BITS 64
+#else
+/* #undef _FILE_OFFSET_BITS */
+#endif
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
diff --git a/src/lib/nt/ntopenat.c b/src/lib/nt/ntopenat.c
index 6db4de7..07ae561 100644
--- a/src/lib/nt/ntopenat.c
+++ b/src/lib/nt/ntopenat.c
@@ -55,9 +55,10 @@ static int birdOpenInt(const char *pszPath, int fFlags, unsigned __int16 fMode)
* directories as the CRT doesn't allow doing that.
*/
int const iErrnoSaved = errno;
+ int iErrno;
int fd = open(pszPath, fFlags, fMode);
if ( fd < 0
- && (errno == EACCES || errno == ENOENT || errno == EISDIR)
+ && ((iErrno = errno) == EACCES || iErrno == ENOENT || iErrno == EISDIR || iErrno == EINVAL /*CIFS*/)
&& (fFlags & (_O_WRONLY | _O_RDWR | _O_RDONLY)) == _O_RDONLY
&& (fFlags & (_O_CREAT | _O_TRUNC | _O_EXCL)) == 0 )
{