diff options
author | Max Kellermann <max@duempel.org> | 2010-07-25 11:09:13 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2010-07-25 12:01:59 +0200 |
commit | e4b7a113fded192d2ad31b68a87cf444f206a04e (patch) | |
tree | e1babf84c86d89469597058521ee72e48df85dfd | |
parent | 7820ebb82ea66619ae72caf3bdeb7fd16d035fdd (diff) | |
download | mpd-e4b7a113fded192d2ad31b68a87cf444f206a04e.tar.gz mpd-e4b7a113fded192d2ad31b68a87cf444f206a04e.tar.xz mpd-e4b7a113fded192d2ad31b68a87cf444f206a04e.zip |
database, ...: remove EINTR checks after stdio calls
MPD doesn't have child processes anymore, and thus we're not expecting
to receive SIGCHLD very often. Since hard disk access isn't
interrupted by signals anyway, we don't need those excessive checks.
-rw-r--r-- | src/database.c | 8 | ||||
-rw-r--r-- | src/output/oss_plugin.c | 2 | ||||
-rw-r--r-- | src/sig_handlers.c | 2 | ||||
-rw-r--r-- | src/state_file.c | 4 | ||||
-rw-r--r-- | src/stored_playlist.c | 20 |
5 files changed, 18 insertions, 18 deletions
diff --git a/src/database.c b/src/database.c index 571589118..f255d6ca5 100644 --- a/src/database.c +++ b/src/database.c @@ -255,11 +255,11 @@ db_save(void) if (ferror(fp)) { g_warning("Failed to write to database file: %s", strerror(errno)); - while (fclose(fp) && errno == EINTR); + fclose(fp); return false; } - while (fclose(fp) && errno == EINTR); + fclose(fp); if (stat(database_path, &st) == 0) database_mtime = st.st_mtime; @@ -282,7 +282,7 @@ db_load(GError **error) assert(database_path != NULL); assert(music_root != NULL); - while (!(fp = fopen(database_path, "r")) && errno == EINTR) ; + fp = fopen(database_path, "r"); if (fp == NULL) { g_set_error(error, db_quark(), errno, "Failed to open database file \"%s\": %s", @@ -383,7 +383,7 @@ db_load(GError **error) success = directory_load(fp, music_root, buffer, error); g_string_free(buffer, true); - while (fclose(fp) && errno == EINTR) ; + fclose(fp); if (!success) return false; diff --git a/src/output/oss_plugin.c b/src/output/oss_plugin.c index cb50954cc..bb4164990 100644 --- a/src/output/oss_plugin.c +++ b/src/output/oss_plugin.c @@ -202,7 +202,7 @@ static void oss_close(struct oss_data *od) { if (od->fd >= 0) - while (close(od->fd) && errno == EINTR) ; + close(od->fd); od->fd = -1; } diff --git a/src/sig_handlers.c b/src/sig_handlers.c index 0b4a24396..99a0b7e06 100644 --- a/src/sig_handlers.c +++ b/src/sig_handlers.c @@ -66,7 +66,7 @@ void initSigHandlers(void) sa.sa_flags = 0; sigemptyset(&sa.sa_mask); sa.sa_handler = SIG_IGN; - while (sigaction(SIGPIPE, &sa, NULL) < 0 && errno == EINTR) ; + x_sigaction(SIGPIPE, &sa); sa.sa_handler = exit_signal_handler; x_sigaction(SIGINT, &sa); diff --git a/src/state_file.c b/src/state_file.c index d9ae155a3..e048de7a0 100644 --- a/src/state_file.c +++ b/src/state_file.c @@ -65,7 +65,7 @@ state_file_write(void) audio_output_state_save(fp); playlist_state_save(fp, &g_playlist); - while(fclose(fp) && errno == EINTR) /* nothing */; + fclose(fp); prev_volume_version = sw_volume_state_get_hash(); prev_output_version = audio_output_state_get_version(); @@ -100,7 +100,7 @@ state_file_read(void) g_warning("Unrecognized line in state file: %s", line); } - while(fclose(fp) && errno == EINTR) /* nothing */; + fclose(fp); prev_volume_version = sw_volume_state_get_hash(); prev_output_version = audio_output_state_get_version(); diff --git a/src/stored_playlist.c b/src/stored_playlist.c index 36a899034..cd2818522 100644 --- a/src/stored_playlist.c +++ b/src/stored_playlist.c @@ -160,7 +160,7 @@ spl_save(GPtrArray *list, const char *utf8path) if (path_fs == NULL) return PLAYLIST_RESULT_BAD_NAME; - while (!(file = fopen(path_fs, "w")) && errno == EINTR); + file = fopen(path_fs, "w"); g_free(path_fs); if (file == NULL) return PLAYLIST_RESULT_ERRNO; @@ -170,7 +170,7 @@ spl_save(GPtrArray *list, const char *utf8path) playlist_print_uri(file, uri); } - while (fclose(file) != 0 && errno == EINTR); + fclose(file); return PLAYLIST_RESULT_SUCCESS; } @@ -189,7 +189,7 @@ spl_load(const char *utf8path) if (path_fs == NULL) return NULL; - while (!(file = fopen(path_fs, "r")) && errno == EINTR); + file = fopen(path_fs, "r"); g_free(path_fs); if (file == NULL) return NULL; @@ -227,7 +227,7 @@ spl_load(const char *utf8path) break; } - while (fclose(file) && errno == EINTR); + fclose(file); return list; } @@ -313,12 +313,12 @@ spl_clear(const char *utf8path) if (path_fs == NULL) return PLAYLIST_RESULT_BAD_NAME; - while (!(file = fopen(path_fs, "w")) && errno == EINTR); + file = fopen(path_fs, "w"); g_free(path_fs); if (file == NULL) return PLAYLIST_RESULT_ERRNO; - while (fclose(file) != 0 && errno == EINTR); + fclose(file); idle_add(IDLE_STORED_PLAYLIST); return PLAYLIST_RESULT_SUCCESS; @@ -393,26 +393,26 @@ spl_append_song(const char *utf8path, struct song *song) if (path_fs == NULL) return PLAYLIST_RESULT_BAD_NAME; - while (!(file = fopen(path_fs, "a")) && errno == EINTR); + file = fopen(path_fs, "a"); g_free(path_fs); if (file == NULL) return PLAYLIST_RESULT_ERRNO; if (fstat(fileno(file), &st) < 0) { int save_errno = errno; - while (fclose(file) != 0 && errno == EINTR); + fclose(file); errno = save_errno; return PLAYLIST_RESULT_ERRNO; } if (st.st_size / (MPD_PATH_MAX + 1) >= (off_t)playlist_max_length) { - while (fclose(file) != 0 && errno == EINTR); + fclose(file); return PLAYLIST_RESULT_TOO_LARGE; } playlist_print_song(file, song); - while (fclose(file) != 0 && errno == EINTR); + fclose(file); idle_add(IDLE_STORED_PLAYLIST); return PLAYLIST_RESULT_SUCCESS; |