diff options
author | Ron Yorston <rmy@pobox.com> | 2014-03-23 21:27:25 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2014-03-23 21:27:25 +0000 |
commit | a89d412ced2d9498260dae34fa8aa9e28fa56ca8 (patch) | |
tree | 657773b0339eab2ffbba00ba8e1300d4a881d919 | |
parent | 439b40bd12f55cfb2f28d3f52831041d21b4393e (diff) | |
download | busybox-w32-a89d412ced2d9498260dae34fa8aa9e28fa56ca8.tar.gz busybox-w32-a89d412ced2d9498260dae34fa8aa9e28fa56ca8.tar.bz2 busybox-w32-a89d412ced2d9498260dae34fa8aa9e28fa56ca8.zip |
Provide fake getpwent_r to reduce changes from upstream
-rw-r--r-- | include/mingw.h | 3 | ||||
-rw-r--r-- | libbb/lineedit.c | 4 |
2 files changed, 3 insertions, 4 deletions
diff --git a/include/mingw.h b/include/mingw.h index b1a28b473..bcf61dbac 100644 --- a/include/mingw.h +++ b/include/mingw.h | |||
@@ -76,6 +76,9 @@ struct passwd { | |||
76 | 76 | ||
77 | IMPL(getpwnam,struct passwd *,NULL,const char *name UNUSED_PARAM); | 77 | IMPL(getpwnam,struct passwd *,NULL,const char *name UNUSED_PARAM); |
78 | struct passwd *getpwuid(int uid); | 78 | struct passwd *getpwuid(int uid); |
79 | static inline void setpwent(void) {} | ||
80 | static inline void endpwent(void) {} | ||
81 | IMPL(getpwent_r,int,ENOENT,struct passwd *pwbuf UNUSED_PARAM,char *buf UNUSED_PARAM,size_t buflen UNUSED_PARAM,struct passwd **pwbufp UNUSED_PARAM); | ||
79 | 82 | ||
80 | /* | 83 | /* |
81 | * signal.h | 84 | * signal.h |
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 4bb1ab783..4cb9eba4b 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -672,18 +672,15 @@ static char *username_path_completion(char *ud) | |||
672 | */ | 672 | */ |
673 | static NOINLINE unsigned complete_username(const char *ud) | 673 | static NOINLINE unsigned complete_username(const char *ud) |
674 | { | 674 | { |
675 | #if !ENABLE_PLATFORM_MINGW32 | ||
676 | /* Using _r function to avoid pulling in static buffers */ | 675 | /* Using _r function to avoid pulling in static buffers */ |
677 | char line_buff[256]; | 676 | char line_buff[256]; |
678 | struct passwd pwd; | 677 | struct passwd pwd; |
679 | struct passwd *result; | 678 | struct passwd *result; |
680 | #endif | ||
681 | unsigned userlen; | 679 | unsigned userlen; |
682 | 680 | ||
683 | ud++; /* skip ~ */ | 681 | ud++; /* skip ~ */ |
684 | userlen = strlen(ud); | 682 | userlen = strlen(ud); |
685 | 683 | ||
686 | #if !ENABLE_PLATFORM_MINGW32 | ||
687 | setpwent(); | 684 | setpwent(); |
688 | while (!getpwent_r(&pwd, line_buff, sizeof(line_buff), &result)) { | 685 | while (!getpwent_r(&pwd, line_buff, sizeof(line_buff), &result)) { |
689 | /* Null usernames should result in all users as possible completions. */ | 686 | /* Null usernames should result in all users as possible completions. */ |
@@ -692,7 +689,6 @@ static NOINLINE unsigned complete_username(const char *ud) | |||
692 | } | 689 | } |
693 | } | 690 | } |
694 | endpwent(); | 691 | endpwent(); |
695 | #endif | ||
696 | 692 | ||
697 | return 1 + userlen; | 693 | return 1 + userlen; |
698 | } | 694 | } |