i want to ask something about locating log error in mysql code

If i get an error like ‘111014 11:10:02 InnoDB: Error: unable to create temporary file; errno: 2’
i can use grep easily find the innodb code like this:

$ grep ‘unable to create temporary file’ -R *
Binary file ha_innodb_plugin_la-os0file.o matches
os/os0file.c: " InnoDB: Error: unable to create temporary file;"

but i can not find the code cause error like this ‘110514 8:59:48 [ERROR] /usr/libexec/mysqld: Sort aborted’

[09:24 PM] root@mail mysql-5.1.50$ grep ‘Sort aborted’ -R *
Docs/mysql.info: Message: Sort aborted
mysql-test/include/mtr_warnings.sql: (“Sort aborted”),
mysql-test/lib/v1/mtr_report.pl: /Sort aborted/ or
Binary file sql/share/english/errmsg.sys matches
sql/share/errmsg.txt: eng “Sort aborted”

and i look the mysqld.cc file ,guess the following code cause the error

sql_print_error("%s: %s",my_progname,str);

but i still have no clue ,can anybody help me? thanks

Maybe it helps searching for perror.

For this particular error, what is the variable TMPDIR set to, and does that folder exist?

yes,TMPDIR has been set to a dir which privilege is set correctly in MySQL,and i note when i interrupted sort query manually ,the error will appear,but from the error ,it seems the query is not interrupted manually,so i want to check the code ,see if i can find something useful

111011 16:15:16 [ERROR] /usr/libexec/mysqld: Sort aborted
111011 16:15:16 [ERROR] /usr/libexec/mysqld: Sort aborted
111011 16:15:16 [ERROR] /usr/libexec/mysqld: Sort aborted
111011 16:15:16 [ERROR] /usr/libexec/mysqld: Sort aborted
111011 16:15:16 [ERROR] /usr/libexec/mysqld: Sort aborted
111011 16:15:16 [ERROR] /usr/libexec/mysqld: Sort aborted
111011 16:15:16 [ERROR] /usr/libexec/mysqld: Sort aborted
111011 16:15:16 [ERROR] /usr/libexec/mysqld: Sort aborted
111011 16:15:16 [ERROR] /usr/libexec/mysqld: Sort aborted