Changeset 454 for trunk/server/source3/lib/smbrun.c
- Timestamp:
- Jun 4, 2010, 3:11:43 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/source3/lib/smbrun.c
r414 r454 83 83 } 84 84 85 #ifdef __OS2__ 86 char buf[8192]; 87 int n, w; 88 const char *newcmd = sanitize ? escape_shell_string(cmd) : cmd; 89 if (!newcmd) { 90 close(*outfd); 91 *outfd = -1; 92 return(82); 93 } 94 // execute script and capture stdout 95 FILE* pipe = popen( newcmd, "rb"); 96 if (pipe) { 97 // get stdout from pipe 98 while( !feof( pipe)) { 99 n = fread( buf, 1, 8192, pipe); 100 // write to file if required 101 if (n>0 && outfd!=NULL) 102 w = write( *outfd, buf, n); 103 } 104 // close and return status 105 pclose( pipe); 106 return 0; 107 } 108 // error, close files 109 close(*outfd); 110 *outfd = -1; 111 return 83; 112 #else 85 113 /* in this method we will exec /bin/sh with the correct 86 114 arguments, after first setting stdout to point at the file */ … … 202 230 exit(83); 203 231 return 1; 232 #endif 204 233 } 205 234
Note:
See TracChangeset
for help on using the changeset viewer.