Bugzilla – Attachment 175794 Details for
Bug 307098
zypper request flood
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Forgot Password
[patch]
corrected patch
zypp-#307098-partial.diff (text/plain), 2.12 KB, created by
Jan Kupec
on 2007-10-01 16:44:19 UTC
(
hide
)
Description:
corrected patch
Filename:
MIME Type:
Creator:
Jan Kupec
Created:
2007-10-01 16:44:19 UTC
Size:
2.12 KB
patch
obsolete
>Index: zypp/media/MediaCurl.cc >=================================================================== >--- zypp/media/MediaCurl.cc (revision 7408) >+++ zypp/media/MediaCurl.cc (working copy) >@@ -1100,6 +1100,10 @@ > ZYPP_THROW(MediaCurlSetOptException(url, _curlError)); > } > >+ // set IFMODSINCE time condition (no download if not modified) >+ curl_easy_setopt(_curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE); >+ curl_easy_setopt(_curl, CURLOPT_TIMEVALUE, PathInfo(target).mtime()); >+ > string destNew = target.asString() + ".new.zypp.XXXXXX"; > char *buf = ::strdup( destNew.c_str()); > if( !buf) >@@ -1299,16 +1303,48 @@ > } > #endif // DETECT_DIR_INDEX > >- if ( ::fchmod( ::fileno(file), filesystem::applyUmaskTo( 0644 ) ) ) >+ long httpReturnCode = 0; >+ CURLcode infoRet = curl_easy_getinfo(_curl, >+ CURLINFO_RESPONSE_CODE, >+ &httpReturnCode); >+ bool modified = true; >+ if (infoRet == CURLE_OK) > { >- ERR << "Failed to chmod file " << destNew << endl; >+ DBG << "HTTP response: " + str::numstring(httpReturnCode); >+ if ( httpReturnCode == 304 ) // not modified >+ { >+ DBG << " Not modified."; >+ modified = false; >+ } >+ DBG << endl; > } >- ::fclose( file ); >+ else >+ { >+ WAR << "Could not get the reponse code." << endl; >+ } > >- if ( rename( destNew, dest ) != 0 ) { >- ERR << "Rename failed" << endl; >- ZYPP_THROW(MediaWriteException(dest)); >+ if (modified || infoRet != CURLE_OK) >+ { >+ // apply umask >+ if ( ::fchmod( ::fileno(file), filesystem::applyUmaskTo( 0644 ) ) ) >+ { >+ ERR << "Failed to chmod file " << destNew << endl; >+ } >+ ::fclose( file ); >+ >+ // move the temp file into dest >+ if ( rename( destNew, dest ) != 0 ) { >+ ERR << "Rename failed" << endl; >+ ZYPP_THROW(MediaWriteException(dest)); >+ } > } >+ else >+ { >+ // close and remove the temp file >+ ::fclose( file ); >+ filesystem::unlink( destNew ); >+ } >+ > DBG << "done: " << PathInfo(dest) << endl; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 307098
:
175753
| 175794