From 5fa034e9c6f593b281959a333480c574ceeded58 Mon Sep 17 00:00:00 2001 From: "Daniel T. Borelli" Date: Mon, 10 Jun 2019 11:38:25 -0300 Subject: [PATCH] Warn when new file names can no longer be generated. --- src/main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 2e19fcc..b0dac9d 100644 --- a/src/main.c +++ b/src/main.c @@ -217,12 +217,19 @@ void scrot_check_if_overwrite_file(char **filename) free(*filename); *filename = newname; + + if (count == max_count) { + fprintf(stderr, "scrot can no longer generate new file names.\n" + "The last attempt is %s\n", newname); + free(newname); + exit(EXIT_FAILURE); + } } void scrot_grab_mouse_pointer(const Imlib_Image image, - const int ix_off, const int iy_off) + const int ix_off, const int iy_off) { XFixesCursorImage *xcim = XFixesGetCursorImage(disp);