]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - afs.c
error.h: Remove is_errno().
[paraslash.git] / afs.c
diff --git a/afs.c b/afs.c
index b74cb45c715adc34a1be87c32b2a251fc5dfdd86..c40537466fd9480265815d034050b745dc2f45d3 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -365,8 +365,11 @@ static int action_if_pattern_matches(struct osl_row *row, void *data)
        name = (char *)name_obj.data;
        if ((!name || !*name) && (pmd->pm_flags & PM_SKIP_EMPTY_NAME))
                return 1;
-       if (!pmd->patterns.size && (pmd->pm_flags & PM_NO_PATTERN_MATCHES_EVERYTHING))
+       if (pmd->patterns.size == 0 &&
+                       (pmd->pm_flags & PM_NO_PATTERN_MATCHES_EVERYTHING)) {
+               pmd->num_matches++;
                return pmd->action(pmd->table, row, name, pmd->data);
+       }
        for (p = pattern_txt; p < pattern_txt + pmd->patterns.size;
                        p += strlen(p) + 1) {
                ret = fnmatch(p, name, pmd->fnmatch_flags);
@@ -455,7 +458,7 @@ static int pass_afd(int fd, char *buf, size_t size)
 }
 
 /**
- * Open the audio file with highest score.
+ * Pass the fd of the next audio file to the server process.
  *
  * This stores all information for streaming the "best" audio file in a shared
  * memory area. The id of that area and an open file descriptor for the next
@@ -467,27 +470,15 @@ static int pass_afd(int fd, char *buf, size_t size)
  */
 static int open_next_audio_file(void)
 {
-       struct osl_row *aft_row;
        struct audio_file_data afd;
        int ret, shmid;
        char buf[8];
-       long score;
-again:
-       PARA_NOTICE_LOG("getting next audio file\n");
-       ret = score_get_best(&aft_row, &score);
+
+       ret = open_and_update_audio_file(&afd);
        if (ret < 0) {
                PARA_ERROR_LOG("%s\n", para_strerror(-ret));
                goto no_admissible_files;
        }
-       ret = open_and_update_audio_file(aft_row, score, &afd);
-       if (ret < 0) {
-               ret = score_delete(aft_row);
-               if (ret < 0) {
-                       PARA_ERROR_LOG("%s\n", para_strerror(-ret));
-                       goto no_admissible_files;
-               }
-               goto again;
-       }
        shmid = ret;
        if (!write_ok(server_socket)) {
                ret = -E_AFS_SOCKET;
@@ -687,7 +678,7 @@ static int make_database_dir(void)
 
        get_database_dir();
        ret = para_mkdir(database_dir, 0777);
-       if (ret >= 0 || is_errno(-ret, EEXIST))
+       if (ret >= 0 || ret == -ERRNO_TO_PARA_ERROR(EEXIST))
                return 1;
        return ret;
 }