  In this paper we continue the analysis of the interplay between non-Fermi
liquid and superconductivity for quantum-critical systems, the low-energy
physics of which is described by an effective model with dynamical
electron-electron interaction $V(\Omega_m) \propto 1/|\Omega_m|^\gamma$ (the
$\gamma$ model). In paper I [A. Abanov and A. V. Chubukov, Phys Rev B. 102,
024524 (2020)] two of us analyzed the $\gamma$ model at $T=0$ for $0<\gamma <1$
and argued that there exist a discrete, infinite set of topologically distinct
solutions for the superconducting gap, all with the same spatial symmetry. The
gap function $\Delta_n (\omega_m)$ for the $n$th solution changes sign $n$
times as the function of Matsubara frequency. In this paper we analyze the
linearized gap equation at a finite $T$. We show that there exist an infinite
set of pairing instability temperatures, $T_{p,n}$, and the eigenfunction
$\Delta_n (\omega_{m})$ changes sign $n$ times as a function of a Matsubara
number $m$. We argue that $\Delta_n (\omega_{m})$ retains its functional form
below $T_{p,n}$ and at $T=0$ coincides with the $n$th solution of the nonlinear
gap equation. Like in paper I, we extend the model to the case when the
interaction in the pairing channel has an additional factor $1/N$ compared to
that in the particle-hole channel. We show that $T_{p,0}$ remains finite at
large $N$ due to special properties of fermions with Matsubara frequencies $\pm
\pi T$, but all other $T_{p,n}$ terminate at $N_{cr} = O(1)$. The gap function
vanishes at $T \to 0$ for $N > N_{cr}$ and remains finite for $N < N_{cr}$.
This is consistent with the $T =0$ analysis.
