
201 Cal.App.2d 369 (1962)
INDENCO, INC., Plaintiff and Respondent,
v.
EVERETT F. EVANS, Defendant and Appellant; W. L. HIGGINS et al., Defendants and Respondents.
Civ. No. 19884. 
California Court of Appeals. First Dist., Div. Two.  
Mar. 15, 1962.
 Woodrow W. Kitchel and D. W. Brobst for Defendant and Appellant.
 Berry, Davis, Channell & McNamara and Herbert Chamberlin for Plaintiff and Respondent.
 Sedgwick, Detert, Moran & Arnold and Ernest Y. Sevier for Defendants and Respondents.
 KAUFMAN, P. J.
 The defendant, Everett Evans, a subcontractor, doing business as Atlas Roofing Company, appeals from a judgment declaring that he is obligated to indemnify the plaintiff and cross-defendant, Indenco, Inc., a general contractor, and the defendants and cross-complainants, W. L. Higgins and Chester Root, doing business as Higgins and Root, by virtue of a hold- harmless and indemnification clause contained in an agreement between the defendant and the general contractor which incorporated certain provisions of the agreement between the general contractor and the owners, Alameda County and the Mount Eden School District. Evans contends that: (1) the judgment is an erroneous adjudication of future rights; and (2) the trial court erred in its interpretation of the contracts.
 The cause as framed by the pleadings was submitted to the trial court on a stipulation of facts as follows: In December *371 1955, plaintiff, Indenco, Inc., by written agreement with the County of Alameda and the Mount Eden School District, undertook, as general contractor, to construct the school buildings of the Mohrland Elementary School. Higgins and Root were the architects who designed the school buildings and were to supervise the construction. Evans was the roofing subcontractor for one of the school buildings.
 The written agreement of December 9, 1955, between Indenco, Inc., and Evans provided that Evans, doing business as Atlas Roofing Company, would: "... supply all necessary labor, materials, protection, carthage and tools to furnish and install the roofing complete as specified for the above job, as shown on the plans and described in the specifications prepared therefor by Higgins and Root, Architects. ..."
 "(a) To assume toward the Contractor all the obligations and responsibilities that the Contractor assumes toward the Owner, as set forth in the Contract, General and Special Conditions, Drawings, Specifications and other Documents hereinabove referred to, insofar as applicable, generally or specifically, to the materials to be furnished and the work to be performed under this Subcontract. ..."
 "(e) To protect and be responsible for his work until it is completed and accepted by the Owner. ..."
 "(h) To indemnify the Contractor against and save him harmless from any and all claims, suits or liability for injuries to property, injuries to persons including death, and from any other claims, suits or liability, on account of any act or omission of the Subcontractor, or any of his officers, agents, employees or servants. ..."
 "(j) To obtain and pay for all permits, licenses, official inspections and taxes of any kind made necessary by his work and to comply with all laws, ordinances and regulations bearing on his work and the conduct thereof. ..."
 "(p) To familiarize himself thoroughly with the building site conditions and with the request for quotations, instructions to bidders, bulletins issued prior to the date for receiving of proposals, plans and specifications for said work, material and equipment, and to be familiar with the shipping and delivery facilities and all other matters and conditions which will affect the operation and completion of said work and to assume all risk therefrom. ..."
 "(r) That the General Contractor has no responsibility for protection of Subcontractor's material and equipment from *372 damage or loss caused by an Act of God, strikes, riots, or other natural or human elements. The Subcontractor shall carry all necessary insurance to protect his own as well as the General Contractor's interest in his work as it progresses." (Emphasis partly added.)
 The agreement between Indenco, Inc. and Evans further provided that: "The general conditions of the contract between Indenco, Inc. and the County of Alameda for the construction of this project are hereby made a part of this purchase order and the provisions contained therein are considered in force and a part of this purchase order to the extent as though actually included herein. ..." (Emphasis added.)
 The general conditions of the contract between Indenco, Inc. and Alameda County, incorporated into the purchase order contract between Indenco and Evans were as follows: "The contractor shall be held responsible for any and all loss, accident, neglect, injury or damage to person, life or property which may be the result of, or may be caused by his building operations or his execution of this contract, and for which the District might be held liable. He shall protect and indemnify the District, the Board, the Architect and/or any officer, agent or employee of the District and save them harmless in every way from all suits or actions at law for damage or injury to persons, life or property that may arise or be occasioned in any way because of his building operations or his execution of this conract." (Emphasis added.) (Paragraph 42.)
 "The contractor shall furnish and place proper guards for the prevention of accidents. He shall provide and maintain any other necessary construction required to secure safety of life or property. He shall maintain during all night hours sufficient lights to prevent accident or damage to life or property." (Paragraph 43.)
 On March 27, 1957, Evans' foreman, one Rayma Perdew, commenced action No. 280743 in the Superior Court of Alameda County, against Indenco, Higgins and Root, and several Does, alleging that he sustained personal injuries because of the failure of Indenco, Inc., to provide a railing around the open ends of the roof as required by law; the roof was the substantially flat roof of one of the buildings being placed by Evans pursuant to the above-mentioned contracts. The accident occurred while Perdew was walking backwards in the act of pulling a machine which accomplished the double purpose of laying a coating of tar on the subroof and laying roofing paper on top of the tar. As Perdew reached one end of *373 the roof, he stepped backwards over the end of the roof, pulling the machine with him.
 Higgins and Root filed a cross-complaint naming Indenco, Inc. as cross- defendant, and praying for declaration of rights and duties under the contract between Indenco, Inc., the County of Alameda and the Mount Eden School District. In January 1958 and July 1959, Indenco, Inc., in writing, requested that Evans assume the defense of Indenco, Inc., and indemnify Indenco, Inc. for any loss arising out of the suit. Both of these requests were refused.
 Thereafter, Indenco, Inc., filed its complaint for declaratory relief in this action naming Evans, Atlas and Higgins and Root as defendants, and alleging that since its contract with Evans provided that Evans assumed all of the obligations of Indenco, Inc., to the school district so far as roofing was concerned, Evans was responsible to both Indenco, Inc., and Higgins and Root. Evans answered, alleging that the Perdew action was predicated on the negligence of Indenco, Inc., and Higgins and Root and not on any negligence of his, and that his contract with Indenco, Inc. did not provide for indemnification for the negligent acts of Indenco, Inc., Higgins and Root. Higgins and Root filed their answer and cross-complaint for declaratory relief.
 The matter was tried by the court without a jury. The court found that the above mentioned contracts between the various parties were in full force and effect at the time of the injury to Perdew, and that: (1) pursuant to the written contract between Indenco, Inc., and Alameda County, Indenco, Inc., was obligated to hold Higgins and Root harmless from all the costs, expenses and fees incurred in connection with Perdew's action so long as Perdew's allegations were limited to charges against Higgins and Root for negligent failure to perform any duty which Indenco, Inc. agreed to perform under its contract with the county; (2) pursuant to the contract between Evans and Indenco, Inc. in which Evans assumed the obligations of Indenco, Inc. to the county insofar as roofing operations were concerned, Evans was obligated to hold both Indenco, Inc. and the architects, Higgins and Root, harmless from all costs, expenses and fees incurred in connection with the Perdew action so long as Perdew's allegations were limited to charges against Indenco, Inc. and Higgins and Root for negligent failure to perform any duty which Evans agreed to perform under his contract with Indenco, Inc. *374
 [1] The first argument on appeal is that since the Perdew action is still pending, the judgment is an erroneous adjudication of future rights in violation of sections 1060 and 1061 of the Code of Civil Procedure. There is no merit in this contention, as our Supreme Court recently approved a declaratory judgment in a similar action (Harvey Machine Co. v. Hatzel & Buehler, Inc., 54 Cal.2d 445 [6 Cal.Rptr. 284, 353 P.2d 924]; Roylance v. Doelger, 57 Cal.2d 255 [19 Cal.Rptr. 7, 368 P.2d 535]).
 The second and major contention is that the trial court erroneously interpreted the above-quoted applicable portions of the contracts between Indenco, Inc., and Alameda County, and Evans and Indenco, Inc. Appellant argues that the trial court erroneously concluded that he was to indemnify Indenco, Inc., and Higgins and Root against their own acts of negligence, while his contract with Indenco, Inc. merely provided that he was to hold them harmless from his own negligence and that of his employees and agents. He contends that the specific provisions of paragraph (h) of his agreement with Indenco, Inc., controls the general provision of the paragraph incorporating the indemnity provisions of the contract between Indenco, Inc., and the county and school district, which place on the general contractor the duty of preventing accidents, etc. (i.e., paragraph 43). We cannot agree. [2] Indemnity agreements, like other contracts, must be so interpreted as to give effect to the mutual intention of the parties as it existed at the time of contracting, so far as the same is ascertainable and lawful (Civ. Code,  1636). [3] The entire agreement must be construed as a whole and each clause considered in the light of all other clauses. Section 1650 of the Civil Code provides that particular clauses of a contract are subordinate to its general intent. [4] It is a primary rule of interpretation that contracts must be construed from their four corners, and the intention of the parties must be collected from the entire instrument and not detached portions thereof, it being necessary to consider all of the parts to determine the meaning of any particular part as well as of the whole. [5] Individual clauses and particular words must be considered in connection with the rest of the agreement, and all of the writing and every word of it will, if possible, be given effect (Ajax Magnolia One Corp. v. Southern Calif. Edison Co., 167 Cal.App.2d 743, 748 [334 P.2d 1053]).
 The Perdew action alleges the negligent failure of the general contractor to provide a railing around the open ends of *375 the roof as required by law. Paragraph (j) of Evans' agreement with Indenco, Inc. provides that Evans undertook "to obtain and pay for all permits, licenses, official inspections and taxes of any kind made necessary by his work and to comply with all laws, ordinances and regulations bearing on his work and the conduct thereof."
 [6] The contract between Indenco, Inc., and Evans here is not like an insurance policy to be construed against one party. Rather, its terms were admittedly arrived at by negotiations between two parties.
 Appellant, relying on Vinnell Co. v. Pacific Elec. Ry. Co., 52 Cal.2d 411 [340 P.2d 604], further argues that the contract cannot be construed to protect Indenco, Inc., against its own acts of negligence, as the contract does not expressly refer to the parties' intention to protect the indemnitee against claims of damage caused by any or even all types of negligent conduct on its part. However, our Supreme Court recently indicated in Harvey Machine Co. v. Hatzel & Buehler, Inc., supra, that the Vinnell rule was not always applicable.
 In the Harvey case, the defendant construction contractors appealed from a judgment declaring that they were obligated to indemnify the plaintiff, Pacific Indemnity Co., Harvey's insurer, against liability imposed by law, pursuant to the provisions of an agreement whereby the defendants with other contractors, undertook to construct a new industrial plant for the Harvey Machine Co. While thus engaged, Sam Mann, an employee of the defendants, fell into an open elevator pit and sustained injuries. After recovering a workmen's compensation award pursuant to his status as an employee of the defendants, Mann sued Harvey as an alleged tortfeasor. Harvey made a demand on the defendants for defense of the Mann action, pursuant to the indemnity provisions of the agreement. The defendants refused on the ground that the contract provisions did not protect the indemnitee-owner against its own acts of negligence. Thereafter, Harvey commenced an action in declaratory relief. By its judgment, the trial court declared the defendants were to pay any and all costs and expenses of Harvey in the Mann action, including any judgment rendered. The indemnification clause in question provided that the defendants agreed to hold harmless Harvey, its officers and employees, against all liability for bodily or personal injuries, including death sustained by any person including employees of defendants, and arising from *376 the use of the premises, facilities or services of Harvey, its officers and employees.
 Our Supreme Court assumed that Mann's injury was the consequence of some breach of duty owed to Mann by Harvey, and pointed out that the Vinnell case was distinguishable on several grounds: first, Harvey, unlike the owner in the Vinnell case, did not maintain independent operations on the premises while the construction was in progress; second, the injury did not result from some conduct or omission unrelated to the performance of the defendant-indemnitor; third, and most significant, the claimed breach of duty was not active affirmative misconduct but at most passive negligence, a failure to act in fulfillment of a duty of care which devolved upon the indemnitee as the owner and occupier of land; and fourth, the misconduct did not relate to some matter over which the indemnitee exercised exclusive control, like the negligent switching of the railroad cars in the Vinnell case. The Supreme Court then concluded that under the circumstances, the parties had knowingly bargained for the very protection in issue and affirmed the declaratory judgment in favor of the owner against the construction contractor.
 [7] Applying similar criteria here, we find that Evans agreed to roof the building for Indenco, Inc., and in the course of its work, to assume toward Indenco, Inc. all the obligations and responsibilities Indenco assumed toward the school district, insofar as roofing operations were concerned, and to comply with all laws bearing on his work; that the injury resulted from conduct directly related to the work of Evans and amounted to an affirmative breach of a legal duty to provide a railing. We must assume for the purpose of this case that the duty to provide a railing was a delegable one, which Indenco, Inc. as general contractor, could lawfully delegate to its roofing subcontractor, Evans. Under these circumstances, we must conclude that the parties knowingly bargained for the very protection here in issue. We note that this is a much narrower interpretation than that reached in the Harvey case, as in the instant case, the trial court properly limited Evans' assumption of Indenco, Inc.'s obligations to the county, to roofing operations. By its carefully worded judgment, the trial court also indicated that if the final determination of the Perdew action was that all the parties were joint tortfeasors as to Perdew, Evans would be subject to the indemnity exception to the common law rule against non-contribution, as the cause of action arose before January 1, 1958 *377 (De La Forest v. Yandle, 171 Cal.App.2d 59 [340 P.2d 52]; Alisal Sanitary Dist. v. Kennedy, 180 Cal.App.2d 69 [4 Cal.Rptr. 379]).
 Judgment affirmed.
 Shoemaker, J., and Agee, J., concurred.
