Don't prompt for user input from stdin if it's not a tty.
[oweals/opkg-lede.git] / libopkg / opkg_install.c
index a76322d12358aa45ca8bf89374e0b37ec5c0459d..52af71e9aca7812b87650efe2a40d535fe1b3fe3 100644 (file)
@@ -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) {