comparison stream/stream_ftp.c @ 31500:b01f807eb183

Use MSG_NOSIGNAL flag if available for send(). This avoids MPlayer quitting due to SIGPIPE at least for these cases. Ignoring SIGPIPE in general would break window-closing with some window-managers.
author reimar
date Sun, 27 Jun 2010 15:04:13 +0000
parents ce0122361a39
children b39155e98ac3
comparison
equal deleted inserted replaced
31499:c0fdef79a5d5 31500:b01f807eb183
212 int hascrlf = cmd[l - 2] == '\r' && cmd[l - 1] == '\n'; 212 int hascrlf = cmd[l - 2] == '\r' && cmd[l - 1] == '\n';
213 213
214 if(hascrlf && l == 2) mp_msg(MSGT_STREAM,MSGL_V, "\n"); 214 if(hascrlf && l == 2) mp_msg(MSGT_STREAM,MSGL_V, "\n");
215 else mp_msg(MSGT_STREAM,MSGL_V, "[ftp] > %s",cmd); 215 else mp_msg(MSGT_STREAM,MSGL_V, "[ftp] > %s",cmd);
216 while(l > 0) { 216 while(l > 0) {
217 int s = send(nControl->handle,cmd,l,0); 217 int s = send(nControl->handle,cmd,l,DEFAULT_SEND_FLAGS);
218 218
219 if(s <= 0) { 219 if(s <= 0) {
220 mp_msg(MSGT_OPEN,MSGL_ERR, "[ftp] write error: %s\n",strerror(errno)); 220 mp_msg(MSGT_OPEN,MSGL_ERR, "[ftp] write error: %s\n",strerror(errno));
221 return 0; 221 return 0;
222 } 222 }
342 // it here in case it turn out to be needed on some other OS 342 // it here in case it turn out to be needed on some other OS
343 //fl=fcntl(p->handle,F_GETFL); 343 //fl=fcntl(p->handle,F_GETFL);
344 //fcntl(p->handle,F_SETFL,fl&~O_NONBLOCK); 344 //fcntl(p->handle,F_SETFL,fl&~O_NONBLOCK);
345 345
346 // send only first byte as OOB due to OOB braindamage in many unices 346 // send only first byte as OOB due to OOB braindamage in many unices
347 send(p->handle,pre_cmd,1,MSG_OOB); 347 send(p->handle,pre_cmd,1,MSG_OOB|DEFAULT_SEND_FLAGS);
348 send(p->handle,pre_cmd+1,sizeof(pre_cmd)-1,0); 348 send(p->handle,pre_cmd+1,sizeof(pre_cmd)-1,DEFAULT_SEND_FLAGS);
349 349
350 //fcntl(p->handle,F_SETFL,fl); 350 //fcntl(p->handle,F_SETFL,fl);
351 351
352 // Get the 426 Transfer aborted 352 // Get the 426 Transfer aborted
353 // Or the 226 Transfer complete 353 // Or the 226 Transfer complete