1.0.22.15: 16 byte align assembly routines on x86 and x86-64
[sbcl.git] / src / runtime / wrap.c
index 8e17e37..5f18738 100644 (file)
@@ -305,10 +305,11 @@ int sb_mkstemp (char *template, mode_t mode) {
        template on every loop, but only the last several characters.
        But I didn't feel like testing the boundary cases in Windows's
        _mktemp. */
-    strcpy((char*)&buf, template);
-    if (MKTEMP((char*)&buf)) {
-      if ((fd=open((char*)&buf, O_CREAT|O_EXCL|O_RDWR, mode))!=-1) {
-        strcpy(template, (char*)&buf);
+    strncpy(buf, template, PATHNAME_BUFFER_SIZE);
+    buf[PATHNAME_BUFFER_SIZE-1]=0; /* force NULL-termination */
+    if (MKTEMP(buf)) {
+      if ((fd=open(buf, O_CREAT|O_EXCL|O_RDWR, mode))!=-1) {
+        strcpy(template, buf);
         return (fd);
       } else
         if (errno != EEXIST)
@@ -358,7 +359,7 @@ uid_homedir(uid_t uid)
         } else {
             char *result = malloc(len + 2);
             if (result) {
-                int nchars = sprintf(result,"%s/",p->pw_dir);
+                unsigned int nchars = sprintf(result,"%s/",p->pw_dir);
                 if (nchars == len + 1) {
                     return result;
                 } else {