From 9c1838f6d9c5e0486e58dcfcc49a7c3106843d37861152294cc69fa198080897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojtek=20Dziewi=C4=99cki?= Date: Tue, 25 Sep 2012 08:55:49 +0000 Subject: [PATCH] - Remove speed patch. OBS-URL: https://build.opensuse.org/package/show/Base:System/less?expand=0&rev=28 --- less-443-speed.patchDoesNotBuild | 191 ------------------------------- less.changes | 2 +- 2 files changed, 1 insertion(+), 192 deletions(-) delete mode 100644 less-443-speed.patchDoesNotBuild diff --git a/less-443-speed.patchDoesNotBuild b/less-443-speed.patchDoesNotBuild deleted file mode 100644 index fefacc5..0000000 --- a/less-443-speed.patchDoesNotBuild +++ /dev/null @@ -1,191 +0,0 @@ -Index: cmdbuf.c -=================================================================== ---- cmdbuf.c.orig -+++ cmdbuf.c -@@ -13,11 +13,16 @@ - * Used only by command() and related functions. - */ - -+#ifndef _GNU_SOURCE -+#define _GNU_SOURCE -+#endif - #include "less.h" - #include "cmd.h" - #include "charset.h" - #if HAVE_STAT -+#include - #include -+#include - #endif - - extern int sc_width; -@@ -1404,6 +1409,7 @@ init_cmdhist() - #if CMD_HISTORY - struct mlist *ml = NULL; - char line[CMDBUF_SIZE]; -+ char buf[BUFSIZ]; - char *filename; - FILE *f; - char *p; -@@ -1415,6 +1421,7 @@ init_cmdhist() - free(filename); - if (f == NULL) - return; -+ setbuf(f, buf); - if (fgets(line, sizeof(line), f) == NULL || - strncmp(line, HISTFILE_FIRST_LINE, strlen(HISTFILE_FIRST_LINE)) != 0) - { -@@ -1489,8 +1496,16 @@ save_cmdhist() - { - #if CMD_HISTORY - char *filename; -+ char *tempname; -+ char buf[BUFSIZ]; - FILE *f; -- int modified = 0; -+ int modified = 0, fd; -+ mode_t umask_save; -+#if HAVE_STAT -+ struct stat st; -+ uid_t uid; -+ gid_t gid; -+#endif - - if (mlist_search.modified) - modified = 1; -@@ -1498,33 +1513,61 @@ save_cmdhist() - if (mlist_shell.modified) - modified = 1; - #endif -- if (!modified) -+ if (!modified) { -+ free(filename); - return; -- filename = histfile_name(); -- if (filename == NULL) -+#if HAVE_STAT -+ /* Do not overwrite other users history files due `su' */ -+ st.st_dev = st.st_ino = 0; -+ st.st_mode = 0600; -+ uid = getuid(); -+ gid = getgid(); -+ if ((stat(filename, &st) == 0) && (uid != 0) && -+ !((st.st_uid == uid) ? (st.st_mode & 0200) -+ : ((st.st_gid == gid) -+ ? (st.st_mode & 0020) -+ : (st.st_mode & 0002)))) -+ { -+ free(filename); - return; -- f = fopen(filename, "w"); -- free(filename); -- if (f == NULL) -+ } -+ -+#endif -+ tempname = malloc((strlen(filename)+strlen("XXXXXX"))*sizeof(char)+2); -+ if (tempname == NULL) { -+ free(filename); - return; --#if HAVE_FCHMOD --{ -- /* Make history file readable only by owner. */ -- int do_chmod = 1; -+ } -+ sprintf(tempname, "%s.XXXXXX", filename); -+ (void)mktemp(tempname); -+ if (*tempname == '\0') { -+ free(filename); -+ free(tempname); -+ return; -+ } -+ -+ umask_save = umask(077); - #if HAVE_STAT -- struct stat statbuf; -- int r = fstat(fileno(f), &statbuf); -- if (r < 0 || !S_ISREG(statbuf.st_mode)) -- /* Don't chmod if not a regular file. */ -- do_chmod = 0; --#endif -- if (do_chmod) -- fchmod(fileno(f), 0600); --} -+ fd = open(tempname, O_CREAT|O_EXCL|O_WRONLY|O_NOFOLLOW, ((st.st_mode & 0777) | 0600)); -+#else -+ fd = open(tempname, O_CREAT|O_EXCL|O_WRONLY|O_NOFOLLOW, 0600)); - #endif -+ (void)umask(umask_save); - -+ if (fd < 0) { -+ free(filename); -+ free(tempname); -+ return; -+ } -+ -+ f = fdopen(fd, "w"); -+ if (f == NULL) { -+ free(filename); -+ free(tempname); -+ return; -+ } -+ setbuf(f, buf); - fprintf(f, "%s\n", HISTFILE_FIRST_LINE); -- - fprintf(f, "%s\n", HISTFILE_SEARCH_SECTION); - save_mlist(&mlist_search, f); - -@@ -1534,5 +1577,10 @@ save_cmdhist() - #endif - - fclose(f); -+ -+ if (rename(tempname, filename) < 0) -+ unlink(tempname); -+ free(filename); -+ free(tempname); - #endif /* CMD_HISTORY */ - } -Index: configure.ac -=================================================================== ---- configure.ac.orig -+++ configure.ac -@@ -253,7 +253,7 @@ AC_TRY_COMPILE([#include - - # Checks for library functions. - AC_TYPE_SIGNAL --AC_CHECK_FUNCS([fsync popen _setjmp sigprocmask sigsetmask snprintf stat system fchmod]) -+AC_CHECK_FUNCS([tcdrain popen _setjmp sigprocmask sigsetmask snprintf stat system fchmod]) - - # AC_CHECK_FUNCS may not work for inline functions, so test these separately. - AC_MSG_CHECKING(for memcpy) -Index: screen.c -=================================================================== ---- screen.c.orig -+++ screen.c -@@ -430,8 +430,8 @@ raw_mode(on) - */ - s = save_term; - } --#if HAVE_FSYNC -- fsync(tty); -+#ifdef HAVE_TCDRAIN -+ tcdrain(tty); - #endif - tcsetattr(tty, TCSADRAIN, &s); - #if MUST_SET_LINE_DISCIPLINE -Index: defines.h.in -=================================================================== ---- defines.h.in.orig -+++ defines.h.in -@@ -222,8 +222,8 @@ - /* Define HAVE_FLOAT if your compiler supports the "double" type. */ - #undef HAVE_FLOAT - --/* Define to 1 if you have the `fsync' function. */ --#undef HAVE_FSYNC -+/* Define to 1 if you have the `tcdrain' function. */ -+#undef HAVE_TCDRAIN - - /* GNU regex library */ - #undef HAVE_GNU_REGEX diff --git a/less.changes b/less.changes index ff21386..8810eb5 100644 --- a/less.changes +++ b/less.changes @@ -25,7 +25,7 @@ Tue Sep 25 07:48:44 UTC 2012 - vdziewiecki@suse.com * Fix bug in displaying status column when scrolling * backwards with -J and -S in effect. -- Comment out speed patch. +- Remove speed patch. - Remove less-429-lessecho-man.patch -------------------------------------------------------------------