summaryrefslogtreecommitdiff
path: root/src/pacman
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-08-08 17:05:25 -0500
committerDan McGee <dan@archlinux.org>2011-08-08 17:05:25 -0500
commit8fa330335f9eb465724ed778464502f844e930ae (patch)
tree2161500fbdc1ca52f0e1bf15c9f0ab90737d5d01 /src/pacman
parentef4757afa5d31ff6a6c09e3410c889f152826f4f (diff)
parent67445334e71eaf6138561eee8e5561733a59fc69 (diff)
Merge branch 'maint'
Conflicts: lib/libalpm/dload.c lib/libalpm/po/fi.po lib/libalpm/po/libalpm.pot po/de.po po/fi.po src/pacman/po/pacman.pot src/pacman/util.c
Diffstat (limited to 'src/pacman')
-rw-r--r--src/pacman/po/de.po2
-rw-r--r--src/pacman/po/fi.po2
-rw-r--r--src/pacman/po/pacman.pot2
-rw-r--r--src/pacman/sync.c11
-rw-r--r--src/pacman/util.c38
5 files changed, 48 insertions, 7 deletions
diff --git a/src/pacman/po/de.po b/src/pacman/po/de.po
index f2279bc7..78bf77b6 100644
--- a/src/pacman/po/de.po
+++ b/src/pacman/po/de.po
@@ -276,7 +276,7 @@ msgstr ""
#, c-format
msgid "%s: install reason has been set to 'explicitly installed'\n"
msgstr ""
-"%s: Installations-Grund wurde auf \"Ausdrücklich installiert\" gesetzt?\n"
+"%s: Installations-Grund wurde auf \"Ausdrücklich installiert\" gesetzt\n"
#, c-format
msgid "Explicitly installed"
diff --git a/src/pacman/po/fi.po b/src/pacman/po/fi.po
index 0b0c511a..d4da37c0 100644
--- a/src/pacman/po/fi.po
+++ b/src/pacman/po/fi.po
@@ -851,7 +851,7 @@ msgstr "Säilytettävät paketit:\n"
#, c-format
msgid " All locally installed packages\n"
-msgstr " Kaikki paikalliset paketit\n"
+msgstr " Kaikki asennetut paketit\n"
#, c-format
msgid " All current sync database packages\n"
diff --git a/src/pacman/po/pacman.pot b/src/pacman/po/pacman.pot
index 2917e00f..bb50f332 100644
--- a/src/pacman/po/pacman.pot
+++ b/src/pacman/po/pacman.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: pacman 3.5.3\n"
"Report-Msgid-Bugs-To: http://bugs.archlinux.org/index.php?project=3\n"
-"POT-Creation-Date: 2011-06-23 21:59-0500\n"
+"POT-Creation-Date: 2011-08-08 16:32-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 42a99020..3846b303 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -628,7 +628,15 @@ static int process_group(alpm_list_t *dbs, const char *group)
group);
select_display(pkgs);
char *array = malloc(count);
- multiselect_question(array, count);
+ if(!array) {
+ ret = 1;
+ goto cleanup;
+ }
+ if(multiselect_question(array, count)) {
+ ret = 1;
+ free(array);
+ goto cleanup;
+ }
int n = 0;
for(i = pkgs; i; i = alpm_list_next(i)) {
if(array[n++] == 0)
@@ -641,6 +649,7 @@ static int process_group(alpm_list_t *dbs, const char *group)
goto cleanup;
}
}
+ free(array);
} else {
for(i = pkgs; i; i = alpm_list_next(i)) {
alpm_pkg_t *pkg = alpm_list_getdata(i);
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 8765da7f..e8c0a299 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -1134,8 +1134,9 @@ static int multiselect_parse(char *array, int count, char *response)
int multiselect_question(char *array, int count)
{
- char response[64];
+ char *response, *lastchar;
FILE *stream;
+ size_t response_len = 64;
if(config->noconfirm) {
stream = stdout;
@@ -1144,12 +1145,21 @@ int multiselect_question(char *array, int count)
stream = stderr;
}
+ response = malloc(response_len);
+ if(!response) {
+ return -1;
+ }
+ lastchar = response + response_len - 1;
+ /* sentinel byte to later see if we filled up the entire string */
+ *lastchar = 1;
+
while(1) {
memset(array, 1, count);
fprintf(stream, "\n");
fprintf(stream, _("Enter a selection (default=all)"));
fprintf(stream, ": ");
+ fflush(stream);
if(config->noconfirm) {
fprintf(stream, "\n");
@@ -1158,7 +1168,24 @@ int multiselect_question(char *array, int count)
flush_term_input();
- if(fgets(response, sizeof(response), stdin)) {
+ if(fgets(response, response_len, stdin)) {
+ const size_t response_incr = 64;
+ /* handle buffer not being large enough to read full line case */
+ while(*lastchar == '\0' && lastchar[-1] != '\n') {
+ response_len += response_incr;
+ response = realloc(response, response_len);
+ if(!response) {
+ return -1;
+ }
+ lastchar = response + response_len - 1;
+ /* sentinel byte */
+ *lastchar = 1;
+ if(fgets(response + response_len - response_incr - 1,
+ response_incr + 1, stdin) == 0) {
+ free(response);
+ return -1;
+ }
+ }
strtrim(response);
if(strlen(response) > 0) {
if(multiselect_parse(array, count, response) == -1) {
@@ -1166,9 +1193,14 @@ int multiselect_question(char *array, int count)
continue;
}
}
+ break;
+ } else {
+ free(response);
+ return -1;
}
- break;
}
+
+ free(response);
return 0;
}