Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37511935
en ru br
Репозитории ALT
S:0.16.19-alt2
5.1: 0.16.17-alt5
4.1: 0.16.17-alt5
4.0: 0.16.17-alt5
3.0: 0.16.17-alt2
www.altlinux.org/Changes

Группа :: Разработка/Прочее
Пакет: dev86

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: dev86-0.16.19-owl-tmp.patch
Скачать


--- dev86/bcc/bcc.c
+++ dev86/bcc/bcc.c
@@ -15,6 +15,7 @@
  *	-M9	MC6809 with bcc
  *	-M0	A framework for the -B option.
  */
+#define _GNU_SOURCE
 #include <stdio.h>
 #ifdef __STDC__
 #include <limits.h>
@@ -123,11 +123,7 @@ int file_count = 0;
 int dyn_count = 0;
 int error_count = 0;
 char * progname = "C";
-#ifdef MSDOS
 char * tmpdir = "";
-#else
-char * tmpdir = "/tmp/";
-#endif
 
 int main P((int argc, char **argv));
 
@@ -198,6 +194,18 @@ char ** argv;
    if ((temp = getenv("BCC_PREFIX")) != 0 )
       localprefix = copystr(temp);
 
+#ifndef MSDOS
+   /* XXX: this brings bcc behaviour in sync with the manual page which
+           states that bcc uses TMPDIR for the temporary directory name.
+           However, temporary file handling in this package is totally
+           insecure and I see no easy way how to fix it. :(
+                                                                -- (GM)
+    */
+   tmpdir = secure_getenv("TMPDIR");
+   if (!tmpdir || !*tmpdir)
+      tmpdir = "/tmp";
+#endif
+
    getargs(argc, argv);
    validate_link_opts();
 
@@ -731,9 +739,9 @@ int use_o;
    {
       char buf[16];
 #ifdef MSDOS
-      sprintf(buf, "$$%05d$", dyn_count++);
+      sprintf(buf, "/$$%05d$", dyn_count++);
 #else
-      sprintf(buf, "$$%04d%05d", dyn_count++, getpid());
+      sprintf(buf, "/$$%04d%05d", dyn_count++, getpid());
 #endif
       file->file = catstr(tmpdir, buf);
    }
@@ -754,9 +762,9 @@ run_unlink()
       char buf[16];
       char * p;
 #ifdef MSDOS
-      sprintf(buf, "$$%05d$", i);
+      sprintf(buf, "/$$%05d$", i);
 #else
-      sprintf(buf, "$$%04d%05d", i, getpid());
+      sprintf(buf, "/$$%04d%05d", i, getpid());
 #endif
       p = catstr(tmpdir, buf);
       if (opt_v>1)
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin