openbsd-ports/audio/ncmpcpp/patches/patch-src_lyrics_cpp
dcoppa 60060e8d62 - Check return values of system() calls (stolen from ubuntu)
- Fix manpage errors and remove USE_GROFF
2012-10-25 13:43:42 +00:00

31 lines
1.0 KiB
Plaintext

$OpenBSD: patch-src_lyrics_cpp,v 1.1 2012/10/25 13:43:42 dcoppa Exp $
Check return values of system() calls
--- src/lyrics.cpp.orig Sun Apr 1 18:49:09 2012
+++ src/lyrics.cpp Thu Oct 25 15:14:57 2012
@@ -377,15 +377,20 @@ void Lyrics::Edit()
if (Config.use_console_editor)
{
- system(("/bin/sh -c \"" + Config.external_editor + " \\\"" + itsFilename + "\\\"\"").c_str());
+ if (system(("/bin/sh -c \"" + Config.external_editor + " \\\"" + itsFilename + "\\\"\"").c_str()) < 0)
+ {
+ ShowMessage("Couldn't edit lyrics");
+ return;
+ }
+
// below is needed as screen gets cleared, but apparently
// ncurses doesn't know about it, so we need to reload main screen
endwin();
initscr();
curs_set(0);
}
- else
- system(("nohup " + Config.external_editor + " \"" + itsFilename + "\" > /dev/null 2>&1 &").c_str());
+ else if (system(("nohup " + Config.external_editor + " \"" + itsFilename + "\" > /dev/null 2>&1 &").c_str()) < 0)
+ ShowMessage("Couldn't edit lyrics");
}
#ifdef HAVE_CURL_CURL_H