From 9924ce1cdcb6e4ab9635d6370ff7db6219c56094 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Fri, 21 Mar 2008 08:50:06 +0000 Subject: [PATCH] apply four post-1.8.2 patches; bump to 1.8.3 --- Makefile | 2 +- applets/applets.c | 2 +- editors/vi.c | 9 ++++++--- libbb/lineedit.c | 9 +++++---- networking/arping.c | 3 ++- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index ac0e55027..49df1197d 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ VERSION = 1 PATCHLEVEL = 8 -SUBLEVEL = 2 +SUBLEVEL = 3 EXTRAVERSION = NAME = Unnamed diff --git a/applets/applets.c b/applets/applets.c index 1950cf34e..11340c4c7 100644 --- a/applets/applets.c +++ b/applets/applets.c @@ -17,7 +17,7 @@ #warning See sources.redhat.com/bugzilla/show_bug.cgi?id=3400 #warning Note that glibc is unsuitable for static linking anyway. #warning If you still want to do it, remove -Wl,--gc-sections -#warning from top-level Makefile and remove this warning. +#warning from file scripts/trylink and remove this warning. #error Aborting compilation. #endif diff --git a/editors/vi.c b/editors/vi.c index 345a9452d..9426ab855 100644 --- a/editors/vi.c +++ b/editors/vi.c @@ -184,6 +184,7 @@ struct globals { #if ENABLE_FEATURE_VI_COLON char *initial_cmds[3]; // currently 2 entries, NULL terminated #endif + char readbuffer[MAX_LINELEN]; }; #define G (*ptr_to_globals) #define text (G.text ) @@ -200,6 +201,10 @@ struct globals { #define term_orig (G.term_orig ) #define term_vi (G.term_vi ) #define initial_cmds (G.initial_cmds ) +#define readbuffer (G.readbuffer ) +#define INIT_G() do { \ + PTR_TO_GLOBALS = xzalloc(sizeof(G)); \ +} while (0) static int init_text_buffer(char *); // init from file or create new static void edit_file(char *); // edit one file @@ -321,7 +326,7 @@ int vi_main(int argc, char **argv) my_pid = getpid(); #endif - PTR_TO_GLOBALS = xzalloc(sizeof(G)); + INIT_G(); #if ENABLE_FEATURE_VI_CRASHME srand((long) my_pid); @@ -2142,8 +2147,6 @@ static int mysleep(int hund) // sleep for 'h' 1/100 seconds return safe_poll(pfd, 1, hund*10) > 0; } -#define readbuffer bb_common_bufsiz1 - static int readed_for_parse; //----- IO Routines -------------------------------------------- diff --git a/libbb/lineedit.c b/libbb/lineedit.c index f65e852b1..4253054c5 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -1211,7 +1211,7 @@ static void parse_prompt(const char *prmt_ptr) #endif #define setTermSettings(fd, argp) tcsetattr(fd, TCSANOW, argp) -#define getTermSettings(fd, argp) tcgetattr(fd, argp); +#define getTermSettings(fd, argp) tcgetattr(fd, argp) static sighandler_t previous_SIGWINCH_handler; @@ -1270,9 +1270,10 @@ int read_line_input(const char *prompt, char *command, int maxsize, line_input_t smalluint prevc; #endif - getTermSettings(0, (void *) &initial_settings); - /* Happens when e.g. stty -echo was run before */ - if (!(initial_settings.c_lflag & ECHO)) { + if (getTermSettings(0, (void *) &initial_settings) < 0 + /* Happens when e.g. stty -echo was run before */ + || !(initial_settings.c_lflag & ECHO) + ) { parse_prompt(prompt); fflush(stdout); fgets(command, maxsize, stdin); diff --git a/networking/arping.c b/networking/arping.c index 44615d5b1..a8ee9bf39 100644 --- a/networking/arping.c +++ b/networking/arping.c @@ -207,7 +207,8 @@ static int recv_pack(unsigned char *buf, int len, struct sockaddr_ll *FROM) } if (last) { - printf(" %u.%03ums\n", last / 1000, last % 1000); + unsigned diff = MONOTONIC_US() - last; + printf(" %u.%03ums\n", diff / 1000, diff % 1000); } else { printf(" UNSOLICITED?\n"); } -- 2.25.1