diff --git a/apps/app_record.c b/apps/app_record.c
index 810806e4843daf835d65ec8c0a432289b25b4ed7..ababa23800ee23f1f2e54416f0f46134b5a006bc 100644
--- a/apps/app_record.c
+++ b/apps/app_record.c
@@ -209,7 +209,7 @@ static int record_exec(struct ast_channel *chan, void *data)
 				ast_copy_string(tmp + tmplen, &(fname.piece[i][1]), sizeof(tmp) - tmplen);
 			}
 			count++;
-		} while ( ast_fileexists(tmp, ext, chan->language) != -1 );
+		} while (ast_fileexists(tmp, ext, chan->language) > 0);
 		pbx_builtin_setvar_helper(chan, "RECORDED_FILE", tmp);
 	} else
 		strncpy(tmp, filename, sizeof(tmp)-1);