summaryrefslogtreecommitdiffstats
path: root/libopkg
diff options
context:
space:
mode:
Diffstat (limited to 'libopkg')
-rw-r--r--libopkg/opkg_install.c4
-rw-r--r--libopkg/user.c7
2 files changed, 8 insertions, 3 deletions
diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c
index a76322d..52af71e 100644
--- a/libopkg/opkg_install.c
+++ b/libopkg/opkg_install.c
@@ -1608,6 +1608,10 @@ static int user_prefers_old_conffile(const char *file_name, const char *backup)
" D : show the differences between the versions (if diff is installed)\n"
" The default action is to keep your current version.\n"
" *** %s (Y/I/N/O/D) [default=N] ? ", file_name, short_file_name);
+
+ if (response == NULL)
+ return 1;
+
if (strcmp(response, "y") == 0
|| strcmp(response, "i") == 0
|| strcmp(response, "yes") == 0) {
diff --git a/libopkg/user.c b/libopkg/user.c
index 8c960dc..dda5013 100644
--- a/libopkg/user.c
+++ b/libopkg/user.c
@@ -15,13 +15,11 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
*/
-#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
-#include <string.h>
+#include <unistd.h>
#include "file_util.h"
#include "str_util.h"
-#include "user.h"
char *get_user_response(const char *format, ...)
{
@@ -32,6 +30,9 @@ char *get_user_response(const char *format, ...)
vprintf(format, ap);
va_end(ap);
+ if (isatty(fileno(stdin)))
+ return NULL;
+
response = (char *)file_read_line_alloc(stdin);
if (response == NULL)
return NULL;