- Timestamp:
- Mar 28, 2012, 12:23:21 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_extern.c
r383 r400 414 414 415 415 PDBGC(5); 416 sl_snprintf(pname, sizeof(pname), _("/proc/self/fd/%d"), pfd); 416 /* Cannot use sprintf because of deadlock in malloc/free */ 417 { 418 static char digit[] = "0123456789"; 419 char str0[128]; 420 char str1[128]; 421 int ival = pfd; 422 int n = 0; 423 int m = 0; 424 425 if (ival < 0) ival = -ival; 426 do { 427 str0[n] = digit[ival % 10]; 428 ++n; 429 ival /= 10; 430 } while (ival); 431 432 if (pfd < 0) 433 { 434 str0[n] = '-'; 435 ++n; 436 } 437 str0[n] = '\0'; 438 str1[n] = '\0'; 439 while (n > 0) 440 { 441 str1[m] = str0[n-1]; 442 ++m; --n; 443 } 444 sl_strlcpy(pname, _("/proc/self/fd/"), sizeof(pname)); 445 sl_strlcat(pname, str1, sizeof(pname)); 446 } 417 447 if (access(pname, R_OK|X_OK) == 0) /* flawfinder: ignore */ 418 448 {
Note:
See TracChangeset
for help on using the changeset viewer.